Project

General

Profile

Actions

Bug #3059

closed

sbin/camcontrol/camcontrol.c: pointless code ?

Added by dcb over 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
09/18/2017
Due date:
% Done:

0%

Estimated time:

Description

dragonfly/sbin/camcontrol/camcontrol.c:688] -> [dragonfly/sbin/camcontrol/camcontrol.c:694]: (warning) Identical condition 'error!=0', second condition is always false

Source code is

if (error != 0)
return(error);
if (arglist & CAM_ARG_GET_SERIAL)
scsiserial(device, retry_count, timeout);
if (error != 0)
return(error);
Actions #1

Updated by lubos over 7 years ago

Perhaps assignment to `error' is missing? Like this:

diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 0fef6e5..1b98c47 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@ -689,7 +689,7 @ scsidoinquiry(struct cam_device *device, int argc, char **argv,
return(error);

if (arglist & CAM_ARG_GET_SERIAL)
- scsiserial(device, retry_count, timeout);
+ error = scsiserial(device, retry_count, timeout);
if (error != 0)
return(error);
Actions #2

Updated by lubos about 7 years ago

As discussed on IRC with swildner, I've sent an email to ngie (freebsd.org) and asked him about reasoning behind fixing this warning in FreeBSD simply by removing the condition which follows my proposed change. This "problem" appears to be present since the beginning of FreeBSD SVN repository so I couldn't find any more info on why return value from scsiserial is not taken into account.

--

Lubos Boucek

Actions #3

Updated by swildner about 7 years ago

  • Status changed from New to Closed

I've pushed the fix, thanks!

Actions

Also available in: Atom PDF