Skip to content

Commit 7c09977

Browse files
ZhouyangJiadavem330
authored andcommitted
net: cxgb3: add error handling for sysfs_create_group
When sysfs_create_group fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling sysfs_create_group. Signed-off-by: Zhouyang Jia <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c14a024 commit 7c09977

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,10 +3362,17 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
33623362

33633363
err = sysfs_create_group(&adapter->port[0]->dev.kobj,
33643364
&cxgb3_attr_group);
3365+
if (err) {
3366+
dev_err(&pdev->dev, "cannot create sysfs group\n");
3367+
goto out_close_led;
3368+
}
33653369

33663370
print_port_info(adapter, ai);
33673371
return 0;
33683372

3373+
out_close_led:
3374+
t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 0);
3375+
33693376
out_free_dev:
33703377
iounmap(adapter->regs);
33713378
for (i = ai->nports0 + ai->nports1 - 1; i >= 0; --i)

0 commit comments

Comments
 (0)