Skip to contentSkip to conversation

ALSA: xen-front: remove redundant error check on ret

PATCH Applied Colin King 3 participants 5 messages May 27, 2018 – May 28, 2018

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ALSA: xen-front: remove redundant error check on ret

From: Colin Ian King <[email protected]>

The error for a -ve value in ret is redundant as all previous assignments to ret have an associated -ve check and hence it is impossible for ret to be less that zero at the point of the check. Remove this redundant error check.

Detected by CoveritScan, CID#1469407 ("Logically Dead code")

---
 sound/xen/xen_snd_front_evtchnl.c | 2 --
 1 file changed, 2 deletions(-)
sound/xen/xen_snd_front_evtchnl.c +0 -2
index d70a62e7f910..102d6e096cc8 100644
@@ -351,8 +351,6 @@ int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info,
 			}
 		}
 	}
-	if (ret < 0)
-		goto fail;
 
 	front_info->num_evt_pairs = num_streams;
 	return 0;
Signature · 1 line
2.17.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 19 lines · Colin King

From: Colin Ian King <[email protected]>

The error for a -ve value in ret is redundant as all previous assignments to ret have an associated -ve check and hence it is impossible for ret to be less that zero at the point of the check. Remove this redundant error check.

Detected by CoveritScan, CID#1469407 ("Logically Dead code")

---
  sound/xen/xen_snd_front_evtchnl.c | 2 --
  1 file changed, 2 deletions(-)
sound/xen/xen_snd_front_evtchnl.c +0 -0
index d70a62e7f910..102d6e096cc8 100644

sound/xen/xen_snd_front_evtchnl.c int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info, · line 356

Quoted 8 lines
sound/xen/xen_snd_front_evtchnl.c +0 -2
@@ -351,8 +351,6 @@ int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info,
  			}
  		}
  	}
-	if (ret < 0)
-		goto fail;
 
  	front_info->num_evt_pairs = num_streams;
  	return 0;

Yep. All branches for error path on the nested for loop have goto statement, thus no need to check error outer the loop.

Takashi Sakamoto

Applied
#2 lore raw
Quoted 34 lines · Takashi Sakamoto

Hi,

Quoted 19 lines · Colin King

From: Colin Ian King <[email protected]>

The error for a -ve value in ret is redundant as all previous assignments to ret have an associated -ve check and hence it is impossible for ret to be less that zero at the point of the check. Remove this redundant error check.

Detected by CoveritScan, CID#1469407 ("Logically Dead code")

---
  sound/xen/xen_snd_front_evtchnl.c | 2 --
  1 file changed, 2 deletions(-)
sound/xen/xen_snd_front_evtchnl.c +0 -0
index d70a62e7f910..102d6e096cc8 100644

sound/xen/xen_snd_front_evtchnl.c int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info, · line 355

Quoted 7 lines
sound/xen/xen_snd_front_evtchnl.c +0 -2
@@ -351,8 +351,6 @@ int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info,
  			}
  		}
  	}
-	if (ret < 0)
-		goto fail;
    	front_info->num_evt_pairs = num_streams;
  	return 0;

Yep. All branches for error path on the nested for loop have goto statement, thus no need to check error outer the loop.

Quoted 1 line

Applied, thanks.

Takashi

Applied
#3 lore raw
In reply to Takashi Sakamoto
Quoted 34 lines · Takashi Sakamoto

Hi,

Quoted 19 lines · Colin King

From: Colin Ian King <[email protected]>

The error for a -ve value in ret is redundant as all previous assignments to ret have an associated -ve check and hence it is impossible for ret to be less that zero at the point of the check. Remove this redundant error check.

Detected by CoveritScan, CID#1469407 ("Logically Dead code")

---
  sound/xen/xen_snd_front_evtchnl.c | 2 --
  1 file changed, 2 deletions(-)
sound/xen/xen_snd_front_evtchnl.c +0 -0
index d70a62e7f910..102d6e096cc8 100644

sound/xen/xen_snd_front_evtchnl.c int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info, · line 355

Quoted 7 lines
sound/xen/xen_snd_front_evtchnl.c +0 -2
@@ -351,8 +351,6 @@ int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info,
  			}
  		}
  	}
-	if (ret < 0)
-		goto fail;
    	front_info->num_evt_pairs = num_streams;
  	return 0;

Yep. All branches for error path on the nested for loop have goto statement, thus no need to check error outer the loop.

Quoted 1 line

Applied, thanks.

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#4 lore raw
In reply to Colin King

Hi,

Quoted 19 lines · Colin King

From: Colin Ian King <[email protected]>

The error for a -ve value in ret is redundant as all previous assignments to ret have an associated -ve check and hence it is impossible for ret to be less that zero at the point of the check. Remove this redundant error check.

Detected by CoveritScan, CID#1469407 ("Logically Dead code")

---
  sound/xen/xen_snd_front_evtchnl.c | 2 --
  1 file changed, 2 deletions(-)
sound/xen/xen_snd_front_evtchnl.c +0 -0
index d70a62e7f910..102d6e096cc8 100644

sound/xen/xen_snd_front_evtchnl.c int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info, · line 356

Quoted 8 lines
sound/xen/xen_snd_front_evtchnl.c +0 -2
@@ -351,8 +351,6 @@ int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info,
  			}
  		}
  	}
-	if (ret < 0)
-		goto fail;
 
  	front_info->num_evt_pairs = num_streams;
  	return 0;

Yep. All branches for error path on the nested for loop have goto statement, thus no need to check error outer the loop.

Takashi Sakamoto

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel