Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754696AbbGXN3M (ORCPT ); Fri, 24 Jul 2015 09:29:12 -0400 Received: from mga14.intel.com ([192.55.52.115]:35118 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754681AbbGXN3I (ORCPT ); Fri, 24 Jul 2015 09:29:08 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,538,1432623600"; d="scan'208";a="753837759" From: Irina Tirdea To: Jonathan Cameron , linux-iio@vger.kernel.org, Hartmut Knaack Cc: linux-kernel@vger.kernel.org, Irina Tirdea Subject: [PATCH v2 2/2] tools: iio: print error message when buffer enable fails Date: Fri, 24 Jul 2015 16:28:06 +0300 Message-Id: <1437744486-16456-3-git-send-email-irina.tirdea@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437744486-16456-1-git-send-email-irina.tirdea@intel.com> References: <1437744486-16456-1-git-send-email-irina.tirdea@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1115 Lines: 35 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: Irina Tirdea --- tools/iio/generic_buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 32f389eb..9f7b85b 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -364,8 +364,11 @@ int main(int argc, char **argv) /* Enable the buffer */ 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; + } scan_size = size_from_channelarray(channels, num_channels); data = malloc(scan_size * buf_len); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/