nvmem: core: fix return value
PATCH 1/1 nvmem: core: fix return value
Dan Carpenter points out that the return code was not set in commit 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()"), but this is not the only issue - we also need to zero wp_gpio to prevent gpiod_put() being called on an error value.
--- drivers/nvmem/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvmem/core.c +4 -1
@@ -781,8 +781,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)if (!config->ignore_wp) nvmem->wp_gpio =gpiod_get_optional (config->dev,"wp" ,GPIOD_OUT_HIGH ); -if (IS_ERR (nvmem->wp_gpio)) +if (IS_ERR (nvmem->wp_gpio)) { + rval =PTR_ERR (nvmem->wp_gpio); + nvmem->wp_gpio =NULL ; goto err_put_device; + }kref_init (&nvmem->refcnt);INIT_LIST_HEAD (&nvmem->cells);
Signature · 7 lines
2.30.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Russell,
Quoted 18 lines · Russell King (Oracle)
Dan Carpenter points out that the return code was not set in commit
60c8b4aebd8e("nvmem: core: fix cleanup afterdev_set_name()"), but this is not the only issue - we also need to zerowp_gpioto preventgpiod_put()being called on an error value.Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Fixes 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()")Signed-off-by Russell King (Oracle) <[email protected]>--- drivers/nvmem/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/nvmem/core.c +0
-0
drivers/nvmem/core.c struct nvmem_device *nvmem_register(const struct nvmem_config *config) · line 787
Quoted 8 lines
drivers/nvmem/core.c +3
-1@@ -781,8 +781,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)if (!config->ignore_wp) nvmem->wp_gpio =gpiod_get_optional (config->dev,"wp" ,GPIOD_OUT_HIGH ); -if (IS_ERR (nvmem->wp_gpio)) +if (IS_ERR (nvmem->wp_gpio)) { + rval =PTR_ERR (nvmem->wp_gpio); + nvmem->wp_gpio =NULL ; goto err_put_device;
I have already added this change while applying v3 patches.
thanks,
--srini
drivers/nvmem/core.c struct nvmem_device *nvmem_register(const struct nvmem_config *config) · line 791
Quoted 4 lines
drivers/nvmem/core.c +1
-0+ }kref_init (&nvmem->refcnt);INIT_LIST_HEAD (&nvmem->cells);
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 16 lines · Srinivas Kandagatla
Hi Russell,
Quoted 13 lines · Russell King (Oracle)
Dan Carpenter points out that the return code was not set in commit
60c8b4aebd8e("nvmem: core: fix cleanup afterdev_set_name()"), but this is not the only issue - we also need to zerowp_gpioto preventgpiod_put()being called on an error value.Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Fixes 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()")Signed-off-by Russell King (Oracle) <[email protected]>--- drivers/nvmem/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 15 lines
drivers/nvmem/core.c struct nvmem_device *nvmem_register(const struct nvmem_config *config) · line 787
Quoted 13 lines
drivers/nvmem/core.c +3
-1@@ -781,8 +781,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)if (!config->ignore_wp) nvmem->wp_gpio =gpiod_get_optional (config->dev,"wp" ,GPIOD_OUT_HIGH ); -if (IS_ERR (nvmem->wp_gpio)) +if (IS_ERR (nvmem->wp_gpio)) { + rval =PTR_ERR (nvmem->wp_gpio); + nvmem->wp_gpio =NULL ; goto err_put_device;I have already added this change while applying v3 patches.
You still need wp_gpio to be NULL'd out, otherwise we'll end up calling gpiod_put() on the error-pointer.
Signature · 7 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Srinivas Kandagatla
AppliedQuoted 33 lines · Russell King (Oracle)
Quoted 16 lines · Srinivas Kandagatla
Hi Russell,
Quoted 13 lines · Russell King (Oracle)
Dan Carpenter points out that the return code was not set in commit
60c8b4aebd8e("nvmem: core: fix cleanup afterdev_set_name()"), but this is not the only issue - we also need to zerowp_gpioto preventgpiod_put()being called on an error value.Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Fixes 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()")Signed-off-by Russell King (Oracle) <[email protected]>--- drivers/nvmem/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Quoted 15 lines
drivers/nvmem/core.c struct nvmem_device *nvmem_register(const struct nvmem_config *config) · line 787
Quoted 13 lines
drivers/nvmem/core.c +3
-1@@ -781,8 +781,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)if (!config->ignore_wp) nvmem->wp_gpio =gpiod_get_optional (config->dev,"wp" ,GPIOD_OUT_HIGH ); -if (IS_ERR (nvmem->wp_gpio)) +if (IS_ERR (nvmem->wp_gpio)) { + rval =PTR_ERR (nvmem->wp_gpio); + nvmem->wp_gpio =NULL ; goto err_put_device;I have already added this change while applying v3 patches.
Quoted 2 lines
You still need
wp_gpioto be NULL'd out, otherwise we'll end up callinggpiod_put()on the error-pointer.
That is true..
applied
thanks,
--srini
Quoted 1 line
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel