From: nizamhaider786@gmail.com
To: laforge@gnumonks.org
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org,
Nijam Haider <nizamhaider786@gmail.com>
Subject: [PATCH 1/2] char: pcmcia: cm4000_cs: Fix failure handling Handled failure cases of device_create()
Date: Mon, 24 May 2021 01:00:28 +0530 [thread overview]
Message-ID: <20210523193029.3178-1-nizamhaider786@gmail.com> (raw)
From: Nijam Haider <nizamhaider786@gmail.com>
Signed-off-by: Nijam Haider <nizamhaider786@gmail.com>
---
drivers/char/pcmcia/cm4000_cs.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 89681f0..d6f5598 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1783,6 +1783,7 @@ static int cm4000_probe(struct pcmcia_device *link)
{
struct cm4000_dev *dev;
int i, ret;
+ struct device *dev_ret;
for (i = 0; i < CM4000_MAX_DEV; i++)
if (dev_table[i] == NULL)
@@ -1814,8 +1815,15 @@ static int cm4000_probe(struct pcmcia_device *link)
return ret;
}
- device_create(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i);
-
+ dev_ret = device_create(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i);
+ if (IS_ERR(dev_ret)) {
+ printk(KERN_ERR "device_create failed for %d\n",
+ i);
+ cm4000_release(link);
+ dev_table[i] = NULL;
+ kfree(dev);
+ return -ENODEV;
+ }
return 0;
}
--
2.7.4
next reply other threads:[~2021-05-23 19:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-23 19:30 nizamhaider786 [this message]
2021-05-23 19:30 ` [PATCH 2/2] char: pcmcia: cm4040_cs: Fix failure handling Handled failure cases of device_create() nizamhaider786
2021-05-24 7:09 ` Greg KH
2021-05-24 7:08 ` [PATCH 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=20210523193029.3178-1-nizamhaider786@gmail.com \
--to=nizamhaider786@gmail.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
/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).