From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [PATCH v2] ipmi: Fix error code in try_smi_init()
Date: Tue, 06 Mar 2018 10:40:11 +0000 [thread overview]
Message-ID: <20180306104011.GA22441@mwanda> (raw)
If platform_device_alloc() fails, then we should return -ENOMEM instead
of returning success. I've also removed the "rv" initialization so that
GCC can maybe detect if we forget to set it in the future.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Don't initialize "rv" and fix a typo in the commit message
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f2a294f78892..c09b279cd55e 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2026,7 +2026,7 @@ int ipmi_si_add_smi(struct si_sm_io *io)
*/
static int try_smi_init(struct smi_info *new_smi)
{
- int rv = 0;
+ int rv;
int i;
char *init_name = NULL;
@@ -2071,6 +2071,7 @@ static int try_smi_init(struct smi_info *new_smi)
new_smi->intf_num);
if (!new_smi->pdev) {
pr_err(PFX "Unable to allocate platform device\n");
+ rv = -ENOMEM;
goto out_err;
}
new_smi->io.dev = &new_smi->pdev->dev;
next reply other threads:[~2018-03-06 10:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-06 10:40 Dan Carpenter [this message]
2018-03-06 11:09 ` [PATCH v2] ipmi: Fix error code in try_smi_init() Arnd Bergmann
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=20180306104011.GA22441@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.