[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YK+UeEK0iyLPl0tg@kroah.com>
Date: Thu, 27 May 2021 14:45:44 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: nizamhaider786@...il.com
Cc: laforge@...monks.org, arnd@...db.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] char: pcmcia: cm4040_cs: Fix failure handling
On Tue, May 25, 2021 at 04:32:35AM +0530, nizamhaider786@...il.com wrote:
> From: Nijam Haider <nizamhaider786@...il.com>
>
> Handled failure cases of device_create()
>
> Signed-off-by: Nijam Haider <nizamhaider786@...il.com>
> ---
> V1 -> V2: Added description and changelog
> ---
> drivers/char/pcmcia/cm4040_cs.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
> index d5e43606339c..526198be91fa 100644
> --- a/drivers/char/pcmcia/cm4040_cs.c
> +++ b/drivers/char/pcmcia/cm4040_cs.c
> @@ -558,6 +558,7 @@ static void reader_release(struct pcmcia_device *link)
> static int reader_probe(struct pcmcia_device *link)
> {
> struct reader_dev *dev;
> + struct device *dev_ret;
> int i, ret;
>
> for (i = 0; i < CM_MAX_DEV; i++) {
> @@ -593,8 +594,14 @@ static int reader_probe(struct pcmcia_device *link)
> return ret;
> }
>
> - device_create(cmx_class, NULL, MKDEV(major, i), NULL, "cmx%d", i);
> -
> + dev_ret = device_create(cmx_class, NULL, MKDEV(major, i), NULL, "cmx%d", i);
> + if (IS_ERR(dev_ret)) {
> + dev_err(&link->dev, "device_create failed for %d\n", i);
> + reader_release(link);
> + dev_table[i] = NULL;
> + kfree(dev);
> + return -ENODEV;
> + }
Same comment as on patch 1/2.
thanks,
greg k-h
Powered by blists - more mailing lists