[PATCH] tools: iio: avoid returning error when channel does not have an offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch avoids getting an error and aborting when a channel does not have a
specific parameter like 'offset' and the file associated with it is not present.
When none of the files from the device folder does not matches the desired channel's
param function iioutils_get_param_float should return 0.

This change is safe previous to calling the function the parameters are set to
their defaults, 0 in case of 'offset'

Signed-off-by: Ioana Ciornei <ciorneiioana@xxxxxxxxx>
---
not tested

 tools/iio/iio_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 5eb6793..cbaf696 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -241,7 +241,7 @@ int iioutils_get_param_float(float *output, const char *param_name,
 		goto error_free_builtname_generic;
 	}
 
-	ret = -ENOENT;
+	ret = 0;
 	while (ent = readdir(dp), ent)
 		if ((strcmp(builtname, ent->d_name) == 0) ||
 		    (strcmp(builtname_generic, ent->d_name) == 0)) {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux