Skip to content

Commit

Permalink
rpmb: Remove some useless locking
Browse files Browse the repository at this point in the history
There is no need for explicit locking when using the ida API, as stated in
the doc related to ida_alloc_range() / ida_free().

So remove rpmb_mutex.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/b1fcc6707ec2b6309d50060fa52ccc2c892afde2.1728507153.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
tititiou36 authored and gregkh committed Oct 13, 2024
1 parent dfc881a commit 3b0889f
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions drivers/misc/rpmb-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/slab.h>

static DEFINE_IDA(rpmb_ida);
static DEFINE_MUTEX(rpmb_mutex);

/**
* rpmb_dev_get() - increase rpmb device ref counter
Expand Down Expand Up @@ -63,9 +62,7 @@ static void rpmb_dev_release(struct device *dev)
{
struct rpmb_dev *rdev = to_rpmb_dev(dev);

mutex_lock(&rpmb_mutex);
ida_free(&rpmb_ida, rdev->id);
mutex_unlock(&rpmb_mutex);
kfree(rdev->descr.dev_id);
kfree(rdev);
}
Expand Down Expand Up @@ -175,9 +172,7 @@ struct rpmb_dev *rpmb_dev_register(struct device *dev,
goto err_free_rdev;
}

mutex_lock(&rpmb_mutex);
ret = ida_alloc(&rpmb_ida, GFP_KERNEL);
mutex_unlock(&rpmb_mutex);
if (ret < 0)
goto err_free_dev_id;
rdev->id = ret;
Expand Down

0 comments on commit 3b0889f

Please sign in to comment.