All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: scoop: Drop if with an always false condition
@ 2021-07-21 20:54 Uwe Kleine-König
  2021-07-22  9:13 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2021-07-21 20:54 UTC (permalink / raw)
  To: Russell King; +Cc: linux-arm-kernel, Greg Kroah-Hartman, kernel

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 <u.kleine-koenig@pengutronix.de>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: scoop: Drop if with an always false condition
  2021-07-21 20:54 [PATCH] ARM: scoop: Drop if with an always false condition Uwe Kleine-König
@ 2021-07-22  9:13 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-07-22  9:13 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Russell King, linux-arm-kernel, kernel

On Wed, Jul 21, 2021 at 10:54:50PM +0200, Uwe Kleine-König wrote:
> 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 <u.kleine-koenig@pengutronix.de>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-22  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 20:54 [PATCH] ARM: scoop: Drop if with an always false condition Uwe Kleine-König
2021-07-22  9:13 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.