diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2016-04-05 03:18:04 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2016-04-05 03:18:04 +0000 |
commit | 63a8ecf3099475c7560036054dae728a1869685e (patch) | |
tree | 25077d46b98c0231e960624e7fea47dc7257f167 /src/sg_read_attr.c | |
parent | 61a0b017ebca98eca9c5d85264af45b3eb1853e5 (diff) | |
download | sg3_utils-63a8ecf3099475c7560036054dae728a1869685e.tar.gz |
clang --analyze static checker clean ups
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@689 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_read_attr.c')
-rw-r--r-- | src/sg_read_attr.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/sg_read_attr.c b/src/sg_read_attr.c index 5083674b..2d87f09d 100644 --- a/src/sg_read_attr.c +++ b/src/sg_read_attr.c @@ -1057,27 +1057,32 @@ main(int argc, char * argv[]) if (NULL == device_name) { if (fname) { - if (f2hex_arr(fname, op->do_raw, 0, rabp, &in_len, op->maxlen)) - return SG_LIB_FILE_ERROR; + if (f2hex_arr(fname, op->do_raw, 0, rabp, &in_len, op->maxlen)) { + ret = SG_LIB_FILE_ERROR; + goto clean_up; + } if (op->do_raw) op->do_raw = 0; /* can interfere on decode */ if (in_len < 4) { pr2serr("--in=%s only decoded %d bytes (needs 4 at least)\n", fname, in_len); - return SG_LIB_SYNTAX_ERROR; + ret = SG_LIB_SYNTAX_ERROR; + goto clean_up; } decode_all_sa_s(rabp, in_len, op); goto clean_up; } pr2serr("missing device name!\n"); usage(); - return SG_LIB_SYNTAX_ERROR; + ret = SG_LIB_SYNTAX_ERROR; + goto clean_up; } if (op->do_raw) { if (sg_set_binary_mode(STDOUT_FILENO) < 0) { perror("sg_set_binary_mode"); - return SG_LIB_FILE_ERROR; + ret = SG_LIB_FILE_ERROR; + goto clean_up; } } @@ -1085,7 +1090,8 @@ main(int argc, char * argv[]) if (sg_fd < 0) { pr2serr("open error: %s: %s\n", device_name, safe_strerror(-sg_fd)); - return SG_LIB_FILE_ERROR; + ret = SG_LIB_FILE_ERROR; + goto clean_up; } res = sg_ll_read_attr(sg_fd, rabp, &resid, op); |