d71b2f459923b589ad32944e35a0cad7426f4517
[openwrt/staging/pepe2k.git] /
1 From 3bf3eb2b95aaf18eff3080444b24673cda8ff9a2 Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <weiyongjun1@huawei.com>
3 Date: Fri, 16 Sep 2016 13:45:17 +0000
4 Subject: [PATCH] spi: bcm-qspi: Fix return value check in bcm_qspi_probe()
5
6 In case of error, the function kcalloc() returns NULL pointer
7 not ERR_PTR(). The IS_ERR() test in the return value check
8 should be replaced with NULL test.
9
10 Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
11 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
12 Signed-off-by: Mark Brown <broonie@kernel.org>
13 ---
14 drivers/spi/spi-bcm-qspi.c | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17 --- a/drivers/spi/spi-bcm-qspi.c
18 +++ b/drivers/spi/spi-bcm-qspi.c
19 @@ -1174,8 +1174,8 @@ int bcm_qspi_probe(struct platform_devic
20
21 qspi->dev_ids = kcalloc(num_irqs, sizeof(struct bcm_qspi_dev_id),
22 GFP_KERNEL);
23 - if (IS_ERR(qspi->dev_ids)) {
24 - ret = PTR_ERR(qspi->dev_ids);
25 + if (!qspi->dev_ids) {
26 + ret = -ENOMEM;
27 goto qspi_probe_err;
28 }
29