* [PATCH v2] staging: pi433: add missing call to cdev_del()
@ 2018-11-26 18:18 Michael Straube
2018-11-27 1:22 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Michael Straube @ 2018-11-26 18:18 UTC (permalink / raw)
To: gregkh; +Cc: linux, dan.carpenter, devel, linux-kernel, Michael Straube
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>
---
v1 -> v2
Use goto and label.
drivers/staging/pi433/pi433_if.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index d72de2105053..b2314636dc89 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1254,7 +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");
- goto cdev_failed;
+ goto del_cdev;
}
/* spi setup */
@@ -1262,6 +1262,8 @@ static int pi433_probe(struct spi_device *spi)
return 0;
+del_cdev:
+ cdev_del(device->cdev);
cdev_failed:
kthread_stop(device->tx_task_struct);
send_thread_failed:
--
2.19.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-27 1:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 18:18 [PATCH v2] staging: pi433: add missing call to cdev_del() Michael Straube
2018-11-27 1:22 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®