[-next] spi: bcm2835aux: remove unneeded NULL check of devm_clk_get
diff mbox series

Message ID 20190123070507.15404-1-yuehaibing@huawei.com
State Accepted
Commit bfc7af6d6df8d75b9c693b8eb98c21aa75c1e377
Headers show
Series
  • [-next] spi: bcm2835aux: remove unneeded NULL check of devm_clk_get
Related show

Commit Message

YueHaibing Jan. 23, 2019, 7:05 a.m. UTC
Fix a static code checker warning:
drivers/spi/spi-bcm2835aux.c:460
 bcm2835aux_spi_probe() warn: passing zero to 'PTR_ERR'

In case of error, the function devm_clk_get() returns ERR_PTR()
and not returns NULL.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/spi/spi-bcm2835aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Wahren Jan. 23, 2019, 4:16 p.m. UTC | #1
> YueHaibing <yuehaibing@huawei.com> hat am 23. Januar 2019 um 08:05 geschrieben:
> 
> 
> Fix a static code checker warning:
> drivers/spi/spi-bcm2835aux.c:460
>  bcm2835aux_spi_probe() warn: passing zero to 'PTR_ERR'
> 
> In case of error, the function devm_clk_get() returns ERR_PTR()
> and not returns NULL.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Acked-by: Stefan Wahren <stefan.wahren@i2se.com>

Patch
diff mbox series

diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
index 671e374..f7e0548 100644
--- a/drivers/spi/spi-bcm2835aux.c
+++ b/drivers/spi/spi-bcm2835aux.c
@@ -456,7 +456,7 @@  static int bcm2835aux_spi_probe(struct platform_device *pdev)
 	}
 
 	bs->clk = devm_clk_get(&pdev->dev, NULL);
-	if ((!bs->clk) || (IS_ERR(bs->clk))) {
+	if (IS_ERR(bs->clk)) {
 		err = PTR_ERR(bs->clk);
 		dev_err(&pdev->dev, "could not get clk: %d\n", err);
 		goto out_master_put;