diff options
author | Zhouyang Jia <jiazhouyang09@gmail.com> | 2018-06-14 23:06:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-06-15 12:15:24 -0400 |
commit | 7c099773b08634df9db0f5be40f0fcc06baa2e1b (patch) | |
tree | 729318838b18af43f972820da4cb58c6ebe59e82 | |
parent | c14a0246bd7dc84a1f393a12019696477aaeaaa8 (diff) |
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 <jiazhouyang09@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 2edfdbdaae48..7b795edd9d3a 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | |||
@@ -3362,10 +3362,17 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3362 | 3362 | ||
3363 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, | 3363 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, |
3364 | &cxgb3_attr_group); | 3364 | &cxgb3_attr_group); |
3365 | if (err) { | ||
3366 | dev_err(&pdev->dev, "cannot create sysfs group\n"); | ||
3367 | goto out_close_led; | ||
3368 | } | ||
3365 | 3369 | ||
3366 | print_port_info(adapter, ai); | 3370 | print_port_info(adapter, ai); |
3367 | return 0; | 3371 | return 0; |
3368 | 3372 | ||
3373 | out_close_led: | ||
3374 | t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 0); | ||
3375 | |||
3369 | out_free_dev: | 3376 | out_free_dev: |
3370 | iounmap(adapter->regs); | 3377 | iounmap(adapter->regs); |
3371 | for (i = ai->nports0 + ai->nports1 - 1; i >= 0; --i) | 3378 | for (i = ai->nports0 + ai->nports1 - 1; i >= 0; --i) |