From: Greg KH <gregkh@linuxfoundation.org>
To: nizamhaider786@gmail.com
Cc: laforge@gnumonks.org, arnd@arndb.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] char: pcmcia: cm4040_cs: Fix failure handling
Date: Thu, 27 May 2021 14:45:44 +0200 [thread overview]
Message-ID: <YK+UeEK0iyLPl0tg@kroah.com> (raw)
In-Reply-To: <20210524230235.571-2-nizamhaider786@gmail.com>
On Tue, May 25, 2021 at 04:32:35AM +0530, nizamhaider786@gmail.com wrote:
> From: Nijam Haider <nizamhaider786@gmail.com>
>
> Handled failure cases of device_create()
>
> Signed-off-by: Nijam Haider <nizamhaider786@gmail.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
next prev parent reply other threads:[~2021-05-27 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 23:02 [PATCH v2 1/2] char: pcmcia: cm4000_cs: Fix failure handling nizamhaider786
2021-05-24 23:02 ` [PATCH v2 2/2] char: pcmcia: cm4040_cs: " nizamhaider786
2021-05-27 12:45 ` Greg KH [this message]
2021-05-27 12:45 ` [PATCH v2 1/2] char: pcmcia: cm4000_cs: " Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YK+UeEK0iyLPl0tg@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nizamhaider786@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).