From: Yang Yingliang Date: Wed, 9 Aug 2023 08:12:27 +0000 (+0800) Subject: platform/x86/siemens: simatic-ipc-batt: fix wrong pointer pass to PTR_ERR() X-Git-Tag: v6.6.7~2021^2~30^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5d5ffa48a6eadb67949590ca78c594836e2ae28;p=platform%2Fkernel%2Flinux-starfive.git platform/x86/siemens: simatic-ipc-batt: fix wrong pointer pass to PTR_ERR() 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 Reviewed-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20230809081227.1221267-1-yangyingliang@huawei.com Signed-off-by: Hans de Goede --- diff --git a/drivers/platform/x86/siemens/simatic-ipc-batt.c b/drivers/platform/x86/siemens/simatic-ipc-batt.c index d66b996..15c08c4 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; }