[PATCH] ARM: scoop: Drop if with an always false condition

Subsystems: arm port, the rest

STALE1839d LANDED

Landed in mainline as 1c1838757611 on 2021-10-19.

2 messages, 2 authors, 2021-07-22 · open the first message on its own page

[PATCH] ARM: scoop: Drop if with an always false condition

From: Uwe Kleine-König <hidden>
Date: 2021-07-21 21:04:46

The remove callback is only called after probe completed successfully.
In this case platform_set_drvdata() was called with a non-NULL argument
and so !sdev is never true.

The motivation for this change is to get rid of non-zero return values
for remove callbacks as their only effect is to trigger a runtime
warning. See commit e5e1c2097881 ("driver core: platform: Emit a warning
if a remove callback returned non-zero") for further details.

Signed-off-by: Uwe Kleine-König <redacted>
---
 arch/arm/common/scoop.c | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 6edb961bd6c1..e74c5bfdc6d3 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -240,9 +240,6 @@ static int scoop_remove(struct platform_device *pdev)
 {
 	struct scoop_dev *sdev = platform_get_drvdata(pdev);
 
-	if (!sdev)
-		return -EINVAL;
-
 	if (sdev->gpio.base != -1)
 		gpiochip_remove(&sdev->gpio);
 
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] ARM: scoop: Drop if with an always false condition

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-07-22 09:15:05

On Wed, Jul 21, 2021 at 10:54:50PM +0200, Uwe Kleine-König wrote:
quoted hunk
The remove callback is only called after probe completed successfully.
In this case platform_set_drvdata() was called with a non-NULL argument
and so !sdev is never true.

The motivation for this change is to get rid of non-zero return values
for remove callbacks as their only effect is to trigger a runtime
warning. See commit e5e1c2097881 ("driver core: platform: Emit a warning
if a remove callback returned non-zero") for further details.

Signed-off-by: Uwe Kleine-König <redacted>
---
 arch/arm/common/scoop.c | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 6edb961bd6c1..e74c5bfdc6d3 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -240,9 +240,6 @@ static int scoop_remove(struct platform_device *pdev)
 {
 	struct scoop_dev *sdev = platform_get_drvdata(pdev);
 
-	if (!sdev)
-		return -EINVAL;
-
 	if (sdev->gpio.base != -1)
 		gpiochip_remove(&sdev->gpio);
 
-- 
2.30.2
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help