diff mbox

[-next] spi: bcm-qspi: Fix return value check in bcm_qspi_probe()

Message ID 1474033517-20430-1-git-send-email-weiyj.lk@gmail.com (mailing list archive)
State Accepted
Commit 3bf3eb2b95aaf18eff3080444b24673cda8ff9a2
Headers show

Commit Message

Wei Yongjun Sept. 16, 2016, 1:45 p.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function kcalloc() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/spi/spi-bcm-qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
index 8fff43e..b1bc823 100644
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -1175,8 +1175,8 @@  int bcm_qspi_probe(struct platform_device *pdev,
 
 	qspi->dev_ids = kcalloc(num_irqs, sizeof(struct bcm_qspi_dev_id),
 				GFP_KERNEL);
-	if (IS_ERR(qspi->dev_ids)) {
-		ret = PTR_ERR(qspi->dev_ids);
+	if (!qspi->dev_ids) {
+		ret = -ENOMEM;
 		goto qspi_probe_err;
 	}