Skip to contentSkip to conversation

bnx2x:Fix error handling in the function bnxc2x_dbcx_set_params

PATCH Yuval Mintz 1 participant 2 messages Jul 19, 2015 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines

This fixes the error handling in the function bnxc2x_dbcx_params for both calls to bnx2x_dcbnl_update_applist by checking if they failed by returning a error code and if so return immediately to this function's caller due to this nonrecoverable internal failure.

Hi Nicholas,

Even assuming this is the reasonable thing to do [which I'm not fully convinced], I don't think this solution is complete - you'd also need to break the iteration in bnx2x_dcbnl_update_applist() [at the moment said function always returns 'rc' from the last dcb_app weve tried setting].

Also, why do you send multiple patches for fixing the same issue in different functions in the same file?

Thanks,
Yuval

Quoted 35 lines
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +2 -1
index 6e4294e..e3cd0c6 100644
@@ -724,7 +724,8 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32
 state)
 			 * Delete app tlvs from dcbnl before reading new
 			 * negotiation results
 			 */
-			bnx2x_dcbnl_update_applist(bp, true);
+			if (bnx2x_dcbnl_update_applist(bp, true))
+				return;
 
 			/* Read remote mib if dcbx is in the FW */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +2 -1
 			if (bnx2x_dcbx_read_shmem_remote_mib(bp))
@@ -748,7 +749,8 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32
 state)
 			/*
 			 * Add new app tlvs to dcbnl
 			 */
-			bnx2x_dcbnl_update_applist(bp, false);
+			if (bnx2x_dcbnl_update_applist(bp, false))
+				return;
 #endif
 			/*

* reconfigure the netdevice with the results of the new
--
2.1.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 3 lines

I am used to sending out one patch per each fix like this for each function. If you don't like me doing this I don't when sending patches for your subsystem(s).

I think that would be preferable.

Quoted 6 lines

In addition would something like this fix your complains about not fixing error handling in bnx2x_dcbnl_update_applist.
int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall) {

(quoted diff) +0 -0
 	int i, err = 0;
 
 	for (i = 0; i < DCBX_MAX_APP_PROTOCOL && err == 0; i++) {

...

Review

Quoted 3 lines
				err = dcb_setapp(bp->dev, &app);
(quoted diff) +2 -0
+				if (err)
+					break;

Well, either that or retain the fact there's an error and return it at the end.