[bnxt] Return proper error codes in probe

Return the proper error codes in bnxt_init_one, to indicate the
correct return status upon completion.  Failure paths could
incorrectly indicate a success.  Correct assertion condition to check
for non-NULL pointer.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
This commit is contained in:
Joseph Wong
2025-05-14 14:08:27 +01:00
committed by Michael Brown
parent 4d39b2dcc6
commit 08edad7ca3

View File

@@ -525,7 +525,7 @@ void bnxt_rx_process ( struct net_device *dev, struct bnxt *bp,
u8 drop; u8 drop;
dump_rx_bd ( rx_cmp, rx_cmp_hi, desc_idx ); dump_rx_bd ( rx_cmp, rx_cmp_hi, desc_idx );
assert ( !iob ); assert ( iob );
drop = bnxt_rx_drop ( bp, iob, rx_cmp, rx_cmp_hi, rx_cmp->len ); drop = bnxt_rx_drop ( bp, iob, rx_cmp, rx_cmp_hi, rx_cmp->len );
dbg_rxp ( iob->data, rx_cmp->len, drop ); dbg_rxp ( iob->data, rx_cmp->len, drop );
if ( drop ) if ( drop )
@@ -2375,7 +2375,7 @@ static int bnxt_init_one ( struct pci_device *pci )
bnxt_get_pci_info ( bp ); bnxt_get_pci_info ( bp );
/* Allocate and Initialise device specific parameters */ /* Allocate and Initialise device specific parameters */
if ( bnxt_alloc_mem ( bp ) != 0 ) { if ( ( err = bnxt_alloc_mem ( bp ) ) != 0 ) {
DBGP ( "- %s ( ): bnxt_alloc_mem Failed\n", __func__ ); DBGP ( "- %s ( ): bnxt_alloc_mem Failed\n", __func__ );
goto err_down_pci; goto err_down_pci;
} }
@@ -2383,17 +2383,20 @@ static int bnxt_init_one ( struct pci_device *pci )
/* Get device specific information */ /* Get device specific information */
if ( bnxt_up_chip ( bp ) != 0 ) { if ( bnxt_up_chip ( bp ) != 0 ) {
DBGP ( "- %s ( ): bnxt_up_chip Failed\n", __func__ ); DBGP ( "- %s ( ): bnxt_up_chip Failed\n", __func__ );
err = -ENODEV;
goto err_down_chip; goto err_down_chip;
} }
/* Register Network device */ /* Register Network device */
if ( register_netdev ( netdev ) != 0 ) { if ( ( err = register_netdev ( netdev ) ) != 0 ) {
DBGP ( "- %s ( ): register_netdev Failed\n", __func__ ); DBGP ( "- %s ( ): register_netdev Failed\n", __func__ );
goto err_down_chip; goto err_down_chip;
} }
return 0; return 0;
unregister_netdev ( netdev );
err_down_chip: err_down_chip:
bnxt_down_chip (bp); bnxt_down_chip (bp);
bnxt_free_mem ( bp ); bnxt_free_mem ( bp );