diff mbox series

[-next] platform/x86/siemens: simatic-ipc-batt: fix wrong pointer pass to PTR_ERR()

Message ID 20230809081227.1221267-1-yangyingliang@huawei.com (mailing list archive)
State Accepted, archived
Headers show
Series [-next] platform/x86/siemens: simatic-ipc-batt: fix wrong pointer pass to PTR_ERR() | expand

Commit Message

Yang Yingliang Aug. 9, 2023, 8:12 a.m. UTC
Fix wrong pointer pass to PTR_ERR() if devm_gpiod_get_index() fails.

Fixes: 917f54340794 ("platform/x86: simatic-ipc: add CMOS battery monitoring")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/platform/x86/siemens/simatic-ipc-batt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilpo Järvinen Aug. 9, 2023, 12:53 p.m. UTC | #1
On Wed, 9 Aug 2023, Yang Yingliang wrote:

> Fix wrong pointer pass to PTR_ERR() if devm_gpiod_get_index() fails.
> 
> Fixes: 917f54340794 ("platform/x86: simatic-ipc: add CMOS battery monitoring")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/platform/x86/siemens/simatic-ipc-batt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/siemens/simatic-ipc-batt.c b/drivers/platform/x86/siemens/simatic-ipc-batt.c
> index d66b9969234b..15c08c4900b8 100644
> --- a/drivers/platform/x86/siemens/simatic-ipc-batt.c
> +++ b/drivers/platform/x86/siemens/simatic-ipc-batt.c
> @@ -198,7 +198,7 @@ int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_tab
>  			flags = GPIOD_OUT_LOW;
>  		priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, flags);
>  		if (IS_ERR(priv.gpios[2])) {
> -			err = PTR_ERR(priv.gpios[1]);
> +			err = PTR_ERR(priv.gpios[2]);
>  			priv.gpios[2] = NULL;
>  			goto out;

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Hans de Goede Aug. 9, 2023, 8:03 p.m. UTC | #2
Hi,

On 8/9/23 10:12, Yang Yingliang wrote:
> Fix wrong pointer pass to PTR_ERR() if devm_gpiod_get_index() fails.
> 
> Fixes: 917f54340794 ("platform/x86: simatic-ipc: add CMOS battery monitoring")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
>  drivers/platform/x86/siemens/simatic-ipc-batt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/siemens/simatic-ipc-batt.c b/drivers/platform/x86/siemens/simatic-ipc-batt.c
> index d66b9969234b..15c08c4900b8 100644
> --- a/drivers/platform/x86/siemens/simatic-ipc-batt.c
> +++ b/drivers/platform/x86/siemens/simatic-ipc-batt.c
> @@ -198,7 +198,7 @@ int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_tab
>  			flags = GPIOD_OUT_LOW;
>  		priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, flags);
>  		if (IS_ERR(priv.gpios[2])) {
> -			err = PTR_ERR(priv.gpios[1]);
> +			err = PTR_ERR(priv.gpios[2]);
>  			priv.gpios[2] = NULL;
>  			goto out;
>  		}
diff mbox series

Patch

diff --git a/drivers/platform/x86/siemens/simatic-ipc-batt.c b/drivers/platform/x86/siemens/simatic-ipc-batt.c
index d66b9969234b..15c08c4900b8 100644
--- a/drivers/platform/x86/siemens/simatic-ipc-batt.c
+++ b/drivers/platform/x86/siemens/simatic-ipc-batt.c
@@ -198,7 +198,7 @@  int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_tab
 			flags = GPIOD_OUT_LOW;
 		priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, flags);
 		if (IS_ERR(priv.gpios[2])) {
-			err = PTR_ERR(priv.gpios[1]);
+			err = PTR_ERR(priv.gpios[2]);
 			priv.gpios[2] = NULL;
 			goto out;
 		}