Skip to contentSkip to conversation

vxge: remove duplicated part of check

PATCH In review Dan Carpenter 3 participants 3 messages Dec 24, 2010 – Dec 28, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vxge: remove duplicated part of check

This is just a cleanup to make the static checkers happy. We don't need to check "own" twice.

drivers/net/vxge/vxge-traffic.c +1 -1
index 42cc298..4c10d6c 100644
@@ -1240,7 +1240,7 @@ enum vxge_hw_status vxge_hw_ring_rxd_next_completed(
 	*t_code	= (u8)VXGE_HW_RING_RXD_T_CODE_GET(control_0);
 
 	/* check whether it is not the end */
-	if (!own || ((*t_code = VXGE_HW_RING_T_CODE_FRM_DROP) && own)) {
+	if (!own || *t_code = VXGE_HW_RING_T_CODE_FRM_DROP) {
 
 		vxge_assert(((struct vxge_hw_ring_rxd_1 *)rxdp)->host_control ! 				0);
#1 lore raw
Quoted 2 lines · Dan Carpenter

This is just a cleanup to make the static checkers happy. We don't need to check "own" twice.

It's indeed probably pretty pointless to put if (!A || (B && A)) because then B, which may rely on A being true, has already occurred. Would anyone find if (!A || (A && B)) to be useful for readability? I found 20-some other occurrences, mostly of the latter type.

julia

Quoted 19 lines
drivers/net/vxge/vxge-traffic.c +1 -2
index 42cc298..4c10d6c 100644
@@ -1240,7 +1240,7 @@ enum vxge_hw_status vxge_hw_ring_rxd_next_completed(
 	*t_code	= (u8)VXGE_HW_RING_RXD_T_CODE_GET(control_0);
 
 	/* check whether it is not the end */
-	if (!own || ((*t_code = VXGE_HW_RING_T_CODE_FRM_DROP) && own)) {
+	if (!own || *t_code = VXGE_HW_RING_T_CODE_FRM_DROP) {
 
 		vxge_assert(((struct vxge_hw_ring_rxd_1 *)rxdp)->host_control !>  				0);
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by Ram Vepa on v1 1/1
#2 lore raw

RE: [patch] vxge: remove duplicated part of check {nodisc}

In reply to Dan Carpenter
Quoted 11 lines

This is just a cleanup to make the static checkers happy. We don't need to check "own" twice.

drivers/net/vxge/vxge- renamed from drivers/net/vxge/vxge-traffic.c +0 -0

traffic.c
index 42cc298..4c10d6c 100644

drivers/net/vxge/vxge-traffic.c enum vxge_hw_status vxge_hw_ring_rxd_next_completed( · line 1246

Quoted 8 lines
drivers/net/vxge/vxge-traffic.c +1 -1
@@ -1240,7 +1240,7 @@ enum vxge_hw_status vxge_hw_ring_rxd_next_completed(
 	*t_code	= (u8)VXGE_HW_RING_RXD_T_CODE_GET(control_0);
 
 	/* check whether it is not the end */
-	if (!own || ((*t_code = VXGE_HW_RING_T_CODE_FRM_DROP) && own)) {
+	if (!own || *t_code = VXGE_HW_RING_T_CODE_FRM_DROP) {
 
 		vxge_assert(((struct vxge_hw_ring_rxd_1 *)rxdp)->host_control
 !>  				0);

Looks good, thanks.