All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: iio: avoid returning error when channel does not have an offset
@ 2015-10-30 13:11 Ioana Ciornei
  2015-10-31 10:13 ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Ioana Ciornei @ 2015-10-30 13:11 UTC (permalink / raw)
  To: linux-iio; +Cc: mranostay, Ioana Ciornei

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@gmail.com>
---
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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-01 19:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-30 13:11 [PATCH] tools: iio: avoid returning error when channel does not have an offset Ioana Ciornei
2015-10-31 10:13 ` Jonathan Cameron
2015-10-31 21:27   ` Ioana Ciornei
2015-11-01 11:30     ` Ioana Ciornei
2015-11-01 18:27       ` Jonathan Cameron
2015-11-01 19:53         ` Ioana Ciornei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.