summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol/camcontrol.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-08-05 12:16:11 +0000
committerdim <dim@FreeBSD.org>2012-08-05 12:16:11 +0000
commit53f13e0527cdd085c670d34e5ad0b018a4ce648e (patch)
tree99674b9dfa9a066e401d40a3f439b44054636fca /sbin/camcontrol/camcontrol.c
parentdd4aba9f57e96eb70a818f9730bcd8dbad26237b (diff)
downloadFreeBSD-src-53f13e0527cdd085c670d34e5ad0b018a4ce648e.zip
FreeBSD-src-53f13e0527cdd085c670d34e5ad0b018a4ce648e.tar.gz
In sbin/camcontrol/camcontrol.c, function smpcmd(), initialize the
'error' variable to zero, to avoid returning garbage in several cases. This fixes the following clang 3.2 warnings: sbin/camcontrol/camcontrol.c:4634:8: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (amt_written == -1) { ^~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4619:7: warning: variable 'error' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (fd_response == 0) { ^~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4617:6: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ MFC after: 1 week
Diffstat (limited to 'sbin/camcontrol/camcontrol.c')
-rw-r--r--sbin/camcontrol/camcontrol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index bae6543..342b6dc 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -4464,7 +4464,7 @@ static int
smpcmd(struct cam_device *device, int argc, char **argv, char *combinedopt,
int retry_count, int timeout)
{
- int c, error;
+ int c, error = 0;
union ccb *ccb;
uint8_t *smp_request = NULL, *smp_response = NULL;
int request_size = 0, response_size = 0;
OpenPOWER on IntegriCloud