Skip to content

Commit 0c4862b

Browse files
Russell King (Oracle)gregkh
authored andcommitted
nvmem: core: fix return value
Dan Carpenter points out that the return code was not set in commit 60c8b4a ("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. Fixes: 560181d ("nvmem: core: fix cleanup after dev_set_name()") Cc: stable@vger.kernel.org Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230127104015.23839-10-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent db3546d commit 0c4862b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/nvmem/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
783783
GPIOD_OUT_HIGH);
784784
if (IS_ERR(nvmem->wp_gpio)) {
785785
rval = PTR_ERR(nvmem->wp_gpio);
786+
nvmem->wp_gpio = NULL;
786787
goto err_put_device;
787788
}
788789

0 commit comments

Comments
 (0)