[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181126180105.GM2970@unbuntlaptop>
Date: Mon, 26 Nov 2018 21:01:05 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Michael Straube <straube.linux@...il.com>
Cc: gregkh@...uxfoundation.org, linux@...f-entwicklungen.de,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: pi433: add missing call to cdev_del()
On Mon, Nov 26, 2018 at 06:53:55PM +0100, Michael Straube wrote:
> 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@...il.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;
No no... That's not the right thing. Do "goto del_cdev;" and add a
label at the end.
del_cdev:
cdev_del(device->cdev);
regards,
dan carpenter
Powered by blists - more mailing lists