diff options
Diffstat (limited to 'lib/objagg.c')
| -rw-r--r-- | lib/objagg.c | 20 | 
1 files changed, 4 insertions, 16 deletions
| diff --git a/lib/objagg.c b/lib/objagg.c index 1e248629ed64..363e43e849ac 100644 --- a/lib/objagg.c +++ b/lib/objagg.c @@ -167,6 +167,9 @@ static int objagg_obj_parent_assign(struct objagg *objagg,  {  	void *delta_priv; +	if (WARN_ON(!objagg_obj_is_root(parent))) +		return -EINVAL; +  	delta_priv = objagg->ops->delta_create(objagg->priv, parent->obj,  					       objagg_obj->obj);  	if (IS_ERR(delta_priv)) @@ -421,7 +424,7 @@ static struct objagg_obj *__objagg_obj_get(struct objagg *objagg, void *obj)   *   * There are 3 main options this function wraps:   * 1) The object according to "obj" already exist. In that case - *    the reference counter is incrementes and the object is returned. + *    the reference counter is incremented and the object is returned.   * 2) The object does not exist, but it can be aggregated within   *    another object. In that case, user ops->delta_create() is called   *    to obtain delta data and a new object is created with returned @@ -903,20 +906,6 @@ static const struct objagg_opt_algo *objagg_opt_algos[] = {  	[OBJAGG_OPT_ALGO_SIMPLE_GREEDY] = &objagg_opt_simple_greedy,  }; -static int objagg_hints_obj_cmp(struct rhashtable_compare_arg *arg, -				const void *obj) -{ -	struct rhashtable *ht = arg->ht; -	struct objagg_hints *objagg_hints = -			container_of(ht, struct objagg_hints, node_ht); -	const struct objagg_ops *ops = objagg_hints->ops; -	const char *ptr = obj; - -	ptr += ht->p.key_offset; -	return ops->hints_obj_cmp ? ops->hints_obj_cmp(ptr, arg->key) : -				    memcmp(ptr, arg->key, ht->p.key_len); -} -  /**   * objagg_hints_get - obtains hints instance   * @objagg:		objagg instance @@ -955,7 +944,6 @@ struct objagg_hints *objagg_hints_get(struct objagg *objagg,  				offsetof(struct objagg_hints_node, obj);  	objagg_hints->ht_params.head_offset =  				offsetof(struct objagg_hints_node, ht_node); -	objagg_hints->ht_params.obj_cmpfn = objagg_hints_obj_cmp;  	err = rhashtable_init(&objagg_hints->node_ht, &objagg_hints->ht_params);  	if (err) |