diff options
author | Hartmut Knaack <knaack.h@gmx.de> | 2015-05-31 14:40:17 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-06-01 08:33:47 +0100 |
commit | 0e799878175aa7d08f5882b6a391de4724c52e9e (patch) | |
tree | 385a2ad8310cab0879a12a2e111a2c5e576e1231 /tools/iio/iio_utils.c | |
parent | 5dc65d791ddafc9f6d944391e379708b6056fc48 (diff) | |
download | linux-0e799878175aa7d08f5882b6a391de4724c52e9e.tar.gz linux-0e799878175aa7d08f5882b6a391de4724c52e9e.tar.bz2 linux-0e799878175aa7d08f5882b6a391de4724c52e9e.zip |
tools:iio: return values directly
Return directly, if no common cleanup is required.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio/iio_utils.c')
-rw-r--r-- | tools/iio/iio_utils.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 5d5831d7dfd0..0524725279bb 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -107,10 +107,9 @@ int iioutils_get_type(unsigned *is_signed, const struct dirent *ent; ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } + if (ret < 0) + return -ENOMEM; + ret = asprintf(&builtname, FORMAT_TYPE_FILE, name); if (ret < 0) { ret = -ENOMEM; @@ -202,7 +201,7 @@ error_free_builtname: free(builtname); error_free_scan_el_dir: free(scan_el_dir); -error_ret: + return ret; } @@ -230,10 +229,9 @@ int iioutils_get_param_float(float *output, const struct dirent *ent; ret = asprintf(&builtname, "%s_%s", name, param_name); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } + if (ret < 0) + return -ENOMEM; + ret = asprintf(&builtname_generic, "%s_%s", generic_name, param_name); if (ret < 0) { @@ -277,7 +275,7 @@ error_free_builtname_generic: free(builtname_generic); error_free_builtname: free(builtname); -error_ret: + return ret; } @@ -326,10 +324,9 @@ int build_channel_array(const char *device_dir, *counter = 0; ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); - if (ret < 0) { - ret = -ENOMEM; - goto error_ret; - } + if (ret < 0) + return -ENOMEM; + dp = opendir(scan_el_dir); if (dp == NULL) { ret = -errno; @@ -526,7 +523,7 @@ error_close_dir: error_free_name: free(scan_el_dir); -error_ret: + return ret; } |