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

Greg Kroah-Hartman gregkh at linuxfoundation.org
Thu Jul 22 02:13:26 PDT 2021


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 at 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 at linuxfoundation.org>



More information about the linux-arm-kernel mailing list