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: [email protected] Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent db3546d commit 0c4862b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)