staging: pi433: fix error return code in pi433_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Tue, 28 Apr 2020 15:06:50 +0000 (15:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 May 2020 10:31:18 +0000 (12:31 +0200)
Fix to return negative error code -ENOMEM from cdev alloc failed error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200428150650.102340-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/pi433/pi433_if.c

index 313d22f..c8d0c63 100644 (file)
@@ -1230,6 +1230,7 @@ static int pi433_probe(struct spi_device *spi)
        device->cdev = cdev_alloc();
        if (!device->cdev) {
                dev_dbg(device->dev, "allocation of cdev failed");
+               retval = -ENOMEM;
                goto cdev_failed;
        }
        device->cdev->owner = THIS_MODULE;