Unverified Commit 625fe3f7 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2754 Sync LTS patches for openEuler-1.0-LTS

Merge Pull Request from: @ci-robot 
 
PR sync from: Zhang Zekun <zhangzekun11@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/CR243DECPGC6BQAMMEQDDQPXM6HSVP5G/ 
Sync 4.19 LTS patches for openEuler-1.0-LTS

1. Fix the wrong alloc flags which may cause sleep in atomic.
2. Fix the wrong bit number.

Add a cover letter for these patches, which can help to generate
PR.

Dan Carpenter (1):
  regmap: rbtree: Use alloc_flags for memory allocations

Richard Fitzgerald (1):
  regmap: rbtree: Fix wrong register marked as in-cache when creating
    new node


-- 
2.17.1
 
https://gitee.com/openeuler/kernel/issues/I8DDE2 
 
Link:https://gitee.com/openeuler/kernel/pulls/2754

 

Reviewed-by: default avatarLiu YongQiang <liuyongqiang13@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents 0648e5e6 98a759ea
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -291,14 +291,14 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,

	blk = krealloc(rbnode->block,
		       blklen * map->cache_word_size,
		       GFP_KERNEL);
		       map->alloc_flags);
	if (!blk)
		return -ENOMEM;

	if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
		present = krealloc(rbnode->cache_present,
				   BITS_TO_LONGS(blklen) * sizeof(*present),
				   GFP_KERNEL);
				   map->alloc_flags);
		if (!present) {
			kfree(blk);
			return -ENOMEM;
@@ -335,7 +335,7 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
	const struct regmap_range *range;
	int i;

	rbnode = kzalloc(sizeof(*rbnode), GFP_KERNEL);
	rbnode = kzalloc(sizeof(*rbnode), map->alloc_flags);
	if (!rbnode)
		return NULL;

@@ -361,13 +361,13 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
	}

	rbnode->block = kmalloc_array(rbnode->blklen, map->cache_word_size,
				      GFP_KERNEL);
				      map->alloc_flags);
	if (!rbnode->block)
		goto err_free;

	rbnode->cache_present = kcalloc(BITS_TO_LONGS(rbnode->blklen),
					sizeof(*rbnode->cache_present),
					GFP_KERNEL);
					map->alloc_flags);
	if (!rbnode->cache_present)
		goto err_free_block;

@@ -468,7 +468,8 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
		if (!rbnode)
			return -ENOMEM;
		regcache_rbtree_set_register(map, rbnode,
					     reg - rbnode->base_reg, value);
					     (reg - rbnode->base_reg) / map->reg_stride,
					     value);
		regcache_rbtree_insert(map, &rbtree_ctx->root, rbnode);
		rbtree_ctx->cached_rbnode = rbnode;
	}