[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250626130219.676866-1-Vladimir.Moskovkin@kaspersky.com>
Date: Thu, 26 Jun 2025 16:02:18 +0300
From: Vladimir Moskovkin <Vladimir.Moskovkin@...persky.com>
To: Linus Walleij <linus.walleij@...aro.org>
CC: Vladimir Moskovkin <Vladimir.Moskovkin@...persky.com>, Bartosz Golaszewski
<brgl@...ev.pl>, <linux-gpio@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] gpio: kempld: Remove redundant check in kempld_gpio_probe()
In kempld_gpio_probe() function 'pdata' pointer is compared to NULL.
But in subsequent call to kempld_gpio_pincount() it is dereferenced inside
kempld_get_mutex() function. kempld-core module ensures that
kempld_platform_data is not NULL for corresponding device, see
kempld_acpi_table[]. So 'if (pdata)' check looks illogical and worsens
code readability.
Remove this check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Vladimir Moskovkin <Vladimir.Moskovkin@...persky.com>
---
drivers/gpio/gpio-kempld.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c
index e38e604baa22..61c4a53865b9 100644
--- a/drivers/gpio/gpio-kempld.c
+++ b/drivers/gpio/gpio-kempld.c
@@ -161,7 +161,7 @@ static int kempld_gpio_probe(struct platform_device *pdev)
chip->owner = THIS_MODULE;
chip->parent = dev;
chip->can_sleep = true;
- if (pdata && pdata->gpio_base)
+ if (pdata->gpio_base)
chip->base = pdata->gpio_base;
else
chip->base = -1;
--
2.34.1
Powered by blists - more mailing lists