lkml.org 
[lkml]   [2018]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging: pi433: add missing call to cdev_del()
Date
If cdev_add() fails, cdev_del() should be called.
Add the missing cdev_del() call as pointed out by
Dan Carpenter.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index d72de2105053..abc98a544929 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1254,6 +1254,7 @@ static int pi433_probe(struct spi_device *spi)
retval = cdev_add(device->cdev, device->devt, 1);
if (retval) {
dev_dbg(device->dev, "register of cdev failed");
+ cdev_del(device->cdev);
goto cdev_failed;
}

--
2.19.2
\
 
 \ /
  Last update: 2018-11-26 18:55    [W:1.124 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site