* [PATCH v2] ipmi: Fix error code in try_smi_init()
@ 2018-03-06 10:40 Dan Carpenter
2018-03-06 11:09 ` Arnd Bergmann
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-03-06 10:40 UTC (permalink / raw)
To: kernel-janitors
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;
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] ipmi: Fix error code in try_smi_init()
2018-03-06 10:40 [PATCH v2] ipmi: Fix error code in try_smi_init() Dan Carpenter
@ 2018-03-06 11:09 ` Arnd Bergmann
0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2018-03-06 11:09 UTC (permalink / raw)
To: kernel-janitors
On Tue, Mar 6, 2018 at 11:40 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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
This addresses my comment, so
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-06 11:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06 10:40 [PATCH v2] ipmi: Fix error code in try_smi_init() Dan Carpenter
2018-03-06 11:09 ` Arnd Bergmann
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.