@@ -844,7 +844,9 @@ void qlcnic_83xx_idc_aen_work(struct work_struct *work)
844
844
int i , err = 0 ;
845
845
846
846
adapter = container_of (work , struct qlcnic_adapter , idc_aen_work .work );
847
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_IDC_ACK );
847
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_IDC_ACK );
848
+ if (err )
849
+ return ;
848
850
849
851
for (i = 1 ; i < QLC_83XX_MBX_AEN_CNT ; i ++ )
850
852
cmd .req .arg [i ] = adapter -> ahw -> mbox_aen [i ];
@@ -1085,8 +1087,10 @@ int qlcnic_83xx_create_rx_ctx(struct qlcnic_adapter *adapter)
1085
1087
cap |= QLC_83XX_FW_CAP_LRO_MSS ;
1086
1088
1087
1089
/* set mailbox hdr and capabilities */
1088
- qlcnic_alloc_mbx_args (& cmd , adapter ,
1089
- QLCNIC_CMD_CREATE_RX_CTX );
1090
+ err = qlcnic_alloc_mbx_args (& cmd , adapter ,
1091
+ QLCNIC_CMD_CREATE_RX_CTX );
1092
+ if (err )
1093
+ return err ;
1090
1094
1091
1095
if (qlcnic_sriov_pf_check (adapter ) || qlcnic_sriov_vf_check (adapter ))
1092
1096
cmd .req .arg [0 ] |= (0x3 << 29 );
@@ -1244,7 +1248,9 @@ int qlcnic_83xx_create_tx_ctx(struct qlcnic_adapter *adapter,
1244
1248
mbx .intr_id = 0xffff ;
1245
1249
mbx .src = 0 ;
1246
1250
1247
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CREATE_TX_CTX );
1251
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CREATE_TX_CTX );
1252
+ if (err )
1253
+ return err ;
1248
1254
1249
1255
if (qlcnic_sriov_pf_check (adapter ) || qlcnic_sriov_vf_check (adapter ))
1250
1256
cmd .req .arg [0 ] |= (0x3 << 29 );
@@ -1390,8 +1396,11 @@ int qlcnic_83xx_config_led(struct qlcnic_adapter *adapter, u32 state,
1390
1396
1391
1397
if (state ) {
1392
1398
/* Get LED configuration */
1393
- qlcnic_alloc_mbx_args (& cmd , adapter ,
1394
- QLCNIC_CMD_GET_LED_CONFIG );
1399
+ status = qlcnic_alloc_mbx_args (& cmd , adapter ,
1400
+ QLCNIC_CMD_GET_LED_CONFIG );
1401
+ if (status )
1402
+ return status ;
1403
+
1395
1404
status = qlcnic_issue_cmd (adapter , & cmd );
1396
1405
if (status ) {
1397
1406
dev_err (& adapter -> pdev -> dev ,
@@ -1405,8 +1414,11 @@ int qlcnic_83xx_config_led(struct qlcnic_adapter *adapter, u32 state,
1405
1414
/* Set LED Configuration */
1406
1415
mbx_in = (LSW (QLC_83XX_LED_CONFIG ) << 16 ) |
1407
1416
LSW (QLC_83XX_LED_CONFIG );
1408
- qlcnic_alloc_mbx_args (& cmd , adapter ,
1409
- QLCNIC_CMD_SET_LED_CONFIG );
1417
+ status = qlcnic_alloc_mbx_args (& cmd , adapter ,
1418
+ QLCNIC_CMD_SET_LED_CONFIG );
1419
+ if (status )
1420
+ return status ;
1421
+
1410
1422
cmd .req .arg [1 ] = mbx_in ;
1411
1423
cmd .req .arg [2 ] = mbx_in ;
1412
1424
cmd .req .arg [3 ] = mbx_in ;
@@ -1423,8 +1435,11 @@ int qlcnic_83xx_config_led(struct qlcnic_adapter *adapter, u32 state,
1423
1435
1424
1436
} else {
1425
1437
/* Restoring default LED configuration */
1426
- qlcnic_alloc_mbx_args (& cmd , adapter ,
1427
- QLCNIC_CMD_SET_LED_CONFIG );
1438
+ status = qlcnic_alloc_mbx_args (& cmd , adapter ,
1439
+ QLCNIC_CMD_SET_LED_CONFIG );
1440
+ if (status )
1441
+ return status ;
1442
+
1428
1443
cmd .req .arg [1 ] = adapter -> ahw -> mbox_reg [0 ];
1429
1444
cmd .req .arg [2 ] = adapter -> ahw -> mbox_reg [1 ];
1430
1445
cmd .req .arg [3 ] = adapter -> ahw -> mbox_reg [2 ];
@@ -1494,10 +1509,18 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,
1494
1509
return ;
1495
1510
1496
1511
if (enable ) {
1497
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_INIT_NIC_FUNC );
1512
+ status = qlcnic_alloc_mbx_args (& cmd , adapter ,
1513
+ QLCNIC_CMD_INIT_NIC_FUNC );
1514
+ if (status )
1515
+ return ;
1516
+
1498
1517
cmd .req .arg [1 ] = BIT_0 | BIT_31 ;
1499
1518
} else {
1500
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_STOP_NIC_FUNC );
1519
+ status = qlcnic_alloc_mbx_args (& cmd , adapter ,
1520
+ QLCNIC_CMD_STOP_NIC_FUNC );
1521
+ if (status )
1522
+ return ;
1523
+
1501
1524
cmd .req .arg [1 ] = BIT_0 | BIT_31 ;
1502
1525
}
1503
1526
status = qlcnic_issue_cmd (adapter , & cmd );
@@ -1514,7 +1537,10 @@ int qlcnic_83xx_set_port_config(struct qlcnic_adapter *adapter)
1514
1537
struct qlcnic_cmd_args cmd ;
1515
1538
int err ;
1516
1539
1517
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_SET_PORT_CONFIG );
1540
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_SET_PORT_CONFIG );
1541
+ if (err )
1542
+ return err ;
1543
+
1518
1544
cmd .req .arg [1 ] = adapter -> ahw -> port_config ;
1519
1545
err = qlcnic_issue_cmd (adapter , & cmd );
1520
1546
if (err )
@@ -1528,7 +1554,10 @@ int qlcnic_83xx_get_port_config(struct qlcnic_adapter *adapter)
1528
1554
struct qlcnic_cmd_args cmd ;
1529
1555
int err ;
1530
1556
1531
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_PORT_CONFIG );
1557
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_PORT_CONFIG );
1558
+ if (err )
1559
+ return err ;
1560
+
1532
1561
err = qlcnic_issue_cmd (adapter , & cmd );
1533
1562
if (err )
1534
1563
dev_info (& adapter -> pdev -> dev , "Get Port config failed\n" );
@@ -1544,7 +1573,10 @@ int qlcnic_83xx_setup_link_event(struct qlcnic_adapter *adapter, int enable)
1544
1573
u32 temp ;
1545
1574
struct qlcnic_cmd_args cmd ;
1546
1575
1547
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_LINK_EVENT );
1576
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_LINK_EVENT );
1577
+ if (err )
1578
+ return err ;
1579
+
1548
1580
temp = adapter -> recv_ctx -> context_id << 16 ;
1549
1581
cmd .req .arg [1 ] = (enable ? 1 : 0 ) | BIT_8 | temp ;
1550
1582
err = qlcnic_issue_cmd (adapter , & cmd );
@@ -1575,7 +1607,11 @@ int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode)
1575
1607
if (adapter -> recv_ctx -> state == QLCNIC_HOST_CTX_STATE_FREED )
1576
1608
return - EIO ;
1577
1609
1578
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIGURE_MAC_RX_MODE );
1610
+ err = qlcnic_alloc_mbx_args (& cmd , adapter ,
1611
+ QLCNIC_CMD_CONFIGURE_MAC_RX_MODE );
1612
+ if (err )
1613
+ return err ;
1614
+
1579
1615
qlcnic_83xx_set_interface_id_promisc (adapter , & temp );
1580
1616
cmd .req .arg [1 ] = (mode ? 1 : 0 ) | temp ;
1581
1617
err = qlcnic_issue_cmd (adapter , & cmd );
@@ -1762,7 +1798,11 @@ void qlcnic_83xx_config_ipaddr(struct qlcnic_adapter *adapter, __be32 ip,
1762
1798
u32 temp = 0 , temp_ip ;
1763
1799
struct qlcnic_cmd_args cmd ;
1764
1800
1765
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIGURE_IP_ADDR );
1801
+ err = qlcnic_alloc_mbx_args (& cmd , adapter ,
1802
+ QLCNIC_CMD_CONFIGURE_IP_ADDR );
1803
+ if (err )
1804
+ return ;
1805
+
1766
1806
qlcnic_83xx_set_interface_id_ipaddr (adapter , & temp );
1767
1807
1768
1808
if (mode == QLCNIC_IP_UP )
@@ -1801,7 +1841,10 @@ int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *adapter, int mode)
1801
1841
if (adapter -> recv_ctx -> state == QLCNIC_HOST_CTX_STATE_FREED )
1802
1842
return 0 ;
1803
1843
1804
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIGURE_HW_LRO );
1844
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIGURE_HW_LRO );
1845
+ if (err )
1846
+ return err ;
1847
+
1805
1848
temp = adapter -> recv_ctx -> context_id << 16 ;
1806
1849
arg1 = lro_bit_mask | temp ;
1807
1850
cmd .req .arg [1 ] = arg1 ;
@@ -1823,8 +1866,9 @@ int qlcnic_83xx_config_rss(struct qlcnic_adapter *adapter, int enable)
1823
1866
0xae7b30b4d0ca2bcbULL , 0x43a38fb04167253dULL ,
1824
1867
0x255b0ec26d5a56daULL };
1825
1868
1826
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIGURE_RSS );
1827
-
1869
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIGURE_RSS );
1870
+ if (err )
1871
+ return err ;
1828
1872
/*
1829
1873
* RSS request:
1830
1874
* bits 3-0: Rsvd
@@ -1930,7 +1974,10 @@ int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
1930
1974
struct qlcnic_cmd_args cmd ;
1931
1975
u32 mac_low , mac_high ;
1932
1976
1933
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_MAC_ADDRESS );
1977
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_MAC_ADDRESS );
1978
+ if (err )
1979
+ return err ;
1980
+
1934
1981
qlcnic_83xx_configure_mac (adapter , mac , QLCNIC_GET_CURRENT_MAC , & cmd );
1935
1982
err = qlcnic_issue_cmd (adapter , & cmd );
1936
1983
@@ -1961,7 +2008,10 @@ void qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *adapter)
1961
2008
if (adapter -> recv_ctx -> state == QLCNIC_HOST_CTX_STATE_FREED )
1962
2009
return ;
1963
2010
1964
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIG_INTR_COAL );
2011
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIG_INTR_COAL );
2012
+ if (err )
2013
+ return ;
2014
+
1965
2015
if (coal -> type == QLCNIC_INTR_COAL_TYPE_RX ) {
1966
2016
temp = adapter -> recv_ctx -> context_id ;
1967
2017
cmd .req .arg [1 ] = QLCNIC_INTR_COAL_TYPE_RX | temp << 16 ;
@@ -2033,7 +2083,10 @@ int qlcnic_enable_eswitch(struct qlcnic_adapter *adapter, u8 port, u8 enable)
2033
2083
return err ;
2034
2084
}
2035
2085
2036
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_TOGGLE_ESWITCH );
2086
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_TOGGLE_ESWITCH );
2087
+ if (err )
2088
+ return err ;
2089
+
2037
2090
cmd .req .arg [1 ] = (port & 0xf ) | BIT_4 ;
2038
2091
err = qlcnic_issue_cmd (adapter , & cmd );
2039
2092
@@ -2061,7 +2114,10 @@ int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *adapter,
2061
2114
return err ;
2062
2115
}
2063
2116
2064
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_SET_NIC_INFO );
2117
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_SET_NIC_INFO );
2118
+ if (err )
2119
+ return err ;
2120
+
2065
2121
cmd .req .arg [1 ] = (nic -> pci_func << 16 );
2066
2122
cmd .req .arg [2 ] = 0x1 << 16 ;
2067
2123
cmd .req .arg [3 ] = nic -> phys_port | (nic -> switch_mode << 16 );
@@ -2093,7 +2149,10 @@ int qlcnic_83xx_get_nic_info(struct qlcnic_adapter *adapter,
2093
2149
u8 op = 0 ;
2094
2150
struct qlcnic_cmd_args cmd ;
2095
2151
2096
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_NIC_INFO );
2152
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_NIC_INFO );
2153
+ if (err )
2154
+ return err ;
2155
+
2097
2156
if (func_id != adapter -> ahw -> pci_func ) {
2098
2157
temp = func_id << 16 ;
2099
2158
cmd .req .arg [1 ] = op | BIT_31 | temp ;
@@ -2140,7 +2199,10 @@ int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *adapter,
2140
2199
int i , err = 0 , j = 0 ;
2141
2200
u32 temp ;
2142
2201
2143
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_PCI_INFO );
2202
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_PCI_INFO );
2203
+ if (err )
2204
+ return err ;
2205
+
2144
2206
err = qlcnic_issue_cmd (adapter , & cmd );
2145
2207
2146
2208
ahw -> act_pci_func = 0 ;
@@ -2195,7 +2257,10 @@ int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type)
2195
2257
struct qlcnic_cmd_args cmd ;
2196
2258
2197
2259
max_ints = adapter -> ahw -> num_msix - 1 ;
2198
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIG_INTRPT );
2260
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_CONFIG_INTRPT );
2261
+ if (err )
2262
+ return err ;
2263
+
2199
2264
cmd .req .arg [1 ] = max_ints ;
2200
2265
2201
2266
if (qlcnic_sriov_vf_check (adapter ))
@@ -2823,7 +2888,11 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter)
2823
2888
dev_info (& adapter -> pdev -> dev , "link state down\n" );
2824
2889
return config ;
2825
2890
}
2826
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_LINK_STATUS );
2891
+
2892
+ err = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_LINK_STATUS );
2893
+ if (err )
2894
+ return err ;
2895
+
2827
2896
err = qlcnic_issue_cmd (adapter , & cmd );
2828
2897
if (err ) {
2829
2898
dev_info (& adapter -> pdev -> dev ,
@@ -3049,7 +3118,9 @@ void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data)
3049
3118
struct net_device * netdev = adapter -> netdev ;
3050
3119
int ret = 0 ;
3051
3120
3052
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_STATISTICS );
3121
+ ret = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_GET_STATISTICS );
3122
+ if (ret )
3123
+ return ;
3053
3124
/* Get Tx stats */
3054
3125
cmd .req .arg [1 ] = BIT_1 | (adapter -> tx_ring -> ctx_id << 16 );
3055
3126
cmd .rsp .num = QLC_83XX_TX_STAT_REGS ;
@@ -3139,7 +3210,9 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev)
3139
3210
goto fail_diag_irq ;
3140
3211
3141
3212
ahw -> diag_cnt = 0 ;
3142
- qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_INTRPT_TEST );
3213
+ ret = qlcnic_alloc_mbx_args (& cmd , adapter , QLCNIC_CMD_INTRPT_TEST );
3214
+ if (ret )
3215
+ goto fail_diag_irq ;
3143
3216
3144
3217
if (adapter -> flags & QLCNIC_MSIX_ENABLED )
3145
3218
intrpt_id = ahw -> intr_tbl [0 ].id ;
0 commit comments