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: 917f543407 ("platform/x86: simatic-ipc: add CMOS battery monitoring")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230809081227.1221267-1-yangyingliang@huawei.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Yang Yingliang 2023-08-09 16:12:27 +08:00 committed by Hans de Goede
parent c56beff203
commit e5d5ffa48a

View File

@ -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;
}