Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mtd: rawnand: lpc32xx_slc: Convert to use devm_gpiod_get_optional()

The initial fix for a GPIO descriptor leak added manual gpiod_put()
calls in the error path and remove function.

This follow-up patch improves upon the fix by switching to the
resource-managed devm_gpiod_get_optional() API.

Suggested-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

authored by

Haotian Zhang and committed by
Miquel Raynal
1f3dcfe5 88fd4e4d

+1 -3
+1 -3
drivers/mtd/nand/raw/lpc32xx_slc.c
··· 854 854 } 855 855 856 856 /* Start with WP disabled, if available */ 857 - host->wp_gpio = gpiod_get_optional(&pdev->dev, NULL, GPIOD_OUT_LOW); 857 + host->wp_gpio = devm_gpiod_get_optional(&pdev->dev, NULL, GPIOD_OUT_LOW); 858 858 res = PTR_ERR_OR_ZERO(host->wp_gpio); 859 859 if (res) { 860 860 if (res != -EPROBE_DEFER) ··· 937 937 dma_release_channel(host->dma_chan); 938 938 enable_wp: 939 939 lpc32xx_wp_enable(host); 940 - gpiod_put(host->wp_gpio); 941 940 942 941 return res; 943 942 } ··· 962 963 writel(tmp, SLC_CTRL(host->io_base)); 963 964 964 965 lpc32xx_wp_enable(host); 965 - gpiod_put(host->wp_gpio); 966 966 } 967 967 968 968 static int lpc32xx_nand_resume(struct platform_device *pdev)