From: Bartosz Golaszewski Date: Sun, 17 Sep 2023 08:58:37 +0000 (+0200) Subject: gpio: sim: initialize a managed pointer when declaring it X-Git-Tag: v6.6.2~438 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5d8a3bf5dcee4e8ad185557cee50691a20a42e11;p=thirdparty%2Fkernel%2Fstable.git gpio: sim: initialize a managed pointer when declaring it [ Upstream commit 9f93f18305f5777820491e6ab9b34422c160371b ] 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: 3faf89f27aab ("gpio: sim: simplify code with cleanup helpers") Suggested-by: Linus Torvalds Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c index 44bf1709a6488..a8e5ac95cf170 100644 --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -1438,10 +1438,10 @@ static const struct config_item_type gpio_sim_device_config_group_type = { static struct config_group * gpio_sim_config_make_device_group(struct config_group *group, const char *name) { - struct gpio_sim_device *dev __free(kfree) = NULL; int id; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + struct gpio_sim_device *dev __free(kfree) = kzalloc(sizeof(*dev), + GFP_KERNEL); if (!dev) return ERR_PTR(-ENOMEM);