Skip to contentSkip to conversation

ipmi: missing error code in try_smi_init()

PATCH Superseded Dan Carpenter 4 participants 5 messages Mar 6, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmi: missing error code in try_smi_init()

If platform_device_alloc() then we should return -ENOMEM instead of returning success.

drivers/char/ipmi/ipmi_si_intf.c +1 -0
index f2a294f78892..ff870aa91cfe 100644
@@ -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;
#1 lore raw
Quoted 4 lines · Dan Carpenter

If platform_device_alloc() then we should return -ENOMEM instead of returning success.

Looks good, though I would probably remove that incorrect 'rv = 0' as well so gcc can catch similar problems in case the function gets changed again.

Quoted 12 lines
drivers/char/ipmi/ipmi_si_intf.c +1 -0
index f2a294f78892..ff870aa91cfe 100644
@@ -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;
#2 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

If platform_device_alloc() then we should return -ENOMEM instead of returning success.

It looks like the word "fails" got lost here.

julia

Quoted 20 lines
drivers/char/ipmi/ipmi_si_intf.c +1 -1
index f2a294f78892..ff870aa91cfe 100644
@@ -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;
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Julia Lawall
Quoted 2 lines · Dan Carpenter

If platform_device_alloc() then we should return -ENOMEM instead of returning success.

It looks like the word "fails" got lost here.

Thanks. Let me resend.

regards,
dan carpenter

#4 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

If platform_device_alloc() then we should return -ENOMEM instead of returning success.

Thanks, queued for next release.

-corey

Quoted 14 lines
drivers/char/ipmi/ipmi_si_intf.c +1 -0
index f2a294f78892..ff870aa91cfe 100644
@@ -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;