Skip to contentSkip to conversation

staging: pi433: fix error return code in pi433_probe()

PATCH New Wei Yongjun 1 participant 1 message Apr 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: pi433: fix error return code in pi433_probe()

Fix to return negative error code -ENOMEM from cdev alloc failed error handling case instead of 0, as done elsewhere in this function.

---
 drivers/staging/pi433/pi433_if.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/pi433/pi433_if.c +1 -0
index 313d22f6210f..c8d0c63fdd1d 100644
@@ -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;