提交 e7231491 编写于 作者: I Irina Tirdea 提交者: Jonathan Cameron

tools: iio: print error message when buffer enable fails

Running generic_buffer without enabling any channel of the
sensor will fail without printing any error message.

Add an error message that indicates buffer enable failed.
Signed-off-by: NIrina Tirdea <irina.tirdea@intel.com>
Acked-by: NHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 ae067cb6
...@@ -364,8 +364,11 @@ int main(int argc, char **argv) ...@@ -364,8 +364,11 @@ int main(int argc, char **argv)
/* Enable the buffer */ /* Enable the buffer */
ret = write_sysfs_int("enable", buf_dir_name, 1); ret = write_sysfs_int("enable", buf_dir_name, 1);
if (ret < 0) if (ret < 0) {
fprintf(stderr,
"Failed to enable buffer: %s\n", strerror(-ret));
goto error_free_buf_dir_name; goto error_free_buf_dir_name;
}
scan_size = size_from_channelarray(channels, num_channels); scan_size = size_from_channelarray(channels, num_channels);
data = malloc(scan_size * buf_len); data = malloc(scan_size * buf_len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册