mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
gpio: sim: initialize a managed pointer when declaring it
Variables managed with __free() should typically be initialized where
they are declared so that the __free() callback is paired with its
counterpart resource allocator. Fix the second instance of using
__free() in gpio-sim to follow this pattern.
Fixes: 3faf89f27a
("gpio: sim: simplify code with cleanup helpers")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
db8588f95c
commit
9f93f18305
1 changed files with 2 additions and 2 deletions
|
@ -1485,10 +1485,10 @@ static const struct config_item_type gpio_sim_device_config_group_type = {
|
||||||
static struct config_group *
|
static struct config_group *
|
||||||
gpio_sim_config_make_device_group(struct config_group *group, const char *name)
|
gpio_sim_config_make_device_group(struct config_group *group, const char *name)
|
||||||
{
|
{
|
||||||
struct gpio_sim_device *dev __free(kfree) = NULL;
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
struct gpio_sim_device *dev __free(kfree) = kzalloc(sizeof(*dev),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue