diff mbox series

spi: acpi: remove superfluous parameter check

Message ID 20200312134507.10000-1-wsa@the-dreams.de (mailing list archive)
State Accepted
Commit 5b16668e638c61a9cd4dffaa41d8b3b6f53f6b3a
Headers show
Series spi: acpi: remove superfluous parameter check | expand

Commit Message

Wolfram Sang March 12, 2020, 1:45 p.m. UTC
From: Wolfram Sang <wsa+renesas@sang-engineering.com>

to_spi_device() already checks 'dev'. No need to do it before calling
it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Found while fiddling with bus_find_device_by_acpi_dev() in the I2C
subsystem.

 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven March 12, 2020, 2:14 p.m. UTC | #1
On Thu, Mar 12, 2020 at 2:46 PM Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> to_spi_device() already checks 'dev'. No need to do it before calling
> it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
Niklas Söderlund March 12, 2020, 2:28 p.m. UTC | #2
Hi Wolfram,

Thanks for your work.

On 2020-03-12 14:45:07 +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> to_spi_device() already checks 'dev'. No need to do it before calling
> it.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> 
> Found while fiddling with bus_find_device_by_acpi_dev() in the I2C
> subsystem.
> 
>  drivers/spi/spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 755221bc3745..75978b6c5834 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -4034,7 +4034,7 @@ static struct spi_device *acpi_spi_find_device_by_adev(struct acpi_device *adev)
>  	struct device *dev;
>  
>  	dev = bus_find_device_by_acpi_dev(&spi_bus_type, adev);
> -	return dev ? to_spi_device(dev) : NULL;
> +	return to_spi_device(dev);
>  }
>  
>  static int acpi_spi_notify(struct notifier_block *nb, unsigned long value,
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 755221bc3745..75978b6c5834 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -4034,7 +4034,7 @@  static struct spi_device *acpi_spi_find_device_by_adev(struct acpi_device *adev)
 	struct device *dev;
 
 	dev = bus_find_device_by_acpi_dev(&spi_bus_type, adev);
-	return dev ? to_spi_device(dev) : NULL;
+	return to_spi_device(dev);
 }
 
 static int acpi_spi_notify(struct notifier_block *nb, unsigned long value,