Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754631AbbGXN2F (ORCPT ); Fri, 24 Jul 2015 09:28:05 -0400 Received: from mga01.intel.com ([192.55.52.88]:59577 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754163AbbGXN2C convert rfc822-to-8bit (ORCPT ); Fri, 24 Jul 2015 09:28:02 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,538,1432623600"; d="scan'208";a="612142374" From: "Tirdea, Irina" To: Hartmut Knaack , Jonathan Cameron , "linux-iio@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 2/2] tools: iio: print error message when buffer enable fails Thread-Topic: [PATCH 2/2] tools: iio: print error message when buffer enable fails Thread-Index: AQHQxZ0yE2ITVNkCZkmge0oTuU2dvp3qnU1A Date: Fri, 24 Jul 2015 13:27:58 +0000 Deferred-Delivery: Fri, 24 Jul 2015 13:27:00 +0000 Message-ID: <1F3AC3675D538145B1661F571FE1805F2F0A8DD1@irsmsx105.ger.corp.intel.com> References: <1437672172-21189-1-git-send-email-irina.tirdea@intel.com> <1437672172-21189-3-git-send-email-irina.tirdea@intel.com> <55B17515.7030508@gmx.de> In-Reply-To: <55B17515.7030508@gmx.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1836 Lines: 61 > -----Original Message----- > From: Hartmut Knaack [mailto:knaack.h@gmx.de] > Sent: 24 July, 2015 2:13 > To: Tirdea, Irina; Jonathan Cameron; linux-iio@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Subject: Re: [PATCH 2/2] tools: iio: print error message when buffer enable fails > > Irina Tirdea schrieb am 23.07.2015 um 19:22: > > 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. > > Hi, > please make use of the error code stored in ret (with negative sign), as > in most cases the value of errno has already changed since the original > error has occurred. > Thanks, > Hi Hartmut, Yes, you are right. Missed that. Will fix in v2. Thanks, Irina > Hartmut > > > > > 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..936469c 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(errno)); > > goto error_free_buf_dir_name; > > + } > > > > scan_size = size_from_channelarray(channels, num_channels); > > data = malloc(scan_size * buf_len); > > -- 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/