Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754219AbbGWXNd (ORCPT ); Thu, 23 Jul 2015 19:13:33 -0400 Received: from mout.gmx.net ([212.227.17.22]:58688 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753765AbbGWXNa (ORCPT ); Thu, 23 Jul 2015 19:13:30 -0400 Message-ID: <55B17515.7030508@gmx.de> Date: Fri, 24 Jul 2015 01:13:25 +0200 From: Hartmut Knaack User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1 MIME-Version: 1.0 To: Irina Tirdea , 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 References: <1437672172-21189-1-git-send-email-irina.tirdea@intel.com> <1437672172-21189-3-git-send-email-irina.tirdea@intel.com> In-Reply-To: <1437672172-21189-3-git-send-email-irina.tirdea@intel.com> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Provags-ID: V03:K0:TXfGv2JjeT1jz86C7dxOQ6t9IW5dhkWmaiy4fBeOx/wEnPK+Whe R/A8j+DaTjswH1AhNf1IZ2/shBmwFPdhBOxeXwlQIEJyAyXUL1S1jG16o3i1oEfBcpQSzKy f5bRmP384qfbn8aALW1zt1ZFBzbCvPKumHKRvay83TJs/mxm+t6fFcB/OSUzfMDBnjaWYDH DpEvD2Q1n2JcnAbkPJLGA== X-UI-Out-Filterresults: notjunk:1;V01:K0:ImBZEXZxkyU=:tVtmp33r2nslkwz1qu0FWZ 7wmG0HdbM4t5Xt+zrTstLzaYw9xyqTPFry3stJ2+kjW4AfT8cqOKhjry0UkmXvoqh9Ne3sKwr IPsbUDEr5hndrTZjlvfeuzRr+I/gvCD9gyTAIA3SBF37alFhwQrCE0eYqRJxkVliLDYrxtO15 ili+NGy4Exg3hIm93oOK06tE+2RceAvoqLIus11dIbVQGHbjr7j0BumWICD/kF1MB44gWO1DT PKKpCu9E8fsFFPIPqWNNQR38NwOQyfIFTtzamFCZ1u4s103H3eLoh0+Sgi4hNbHU5AurLWxKJ QE7zUkV0FnaJv6dLszqKz5/mcJ1mPTE931E45OnkbiT6T5RXZrfbU+YkjrKpaHQgdVDCEYEMj FoUD31nyO8mCwcT2vM9Qv9ci2sb6+3LxLYLX8lo12CyuIWhnfioudKsOFtCwwYE0240m5COpd t+bwNC5zo5DWmYkxPBzc2ZJIwJLE8s1ijCxx2fFBHMadrwmvJ2SEmrLDPn4QsmyrRroAoJkrs pYu5xYCcJaQeBZ6SEyDuNz/k5ocIZ3OfavYywJPUziW+YW0Ttc6v87mtcg8bcVf9PW2FNAs4P y92GBVpm69fZO0/H1j0T6NzQZvWjtXXOpLrhY9DAKwdSs4cE2aZtejFWPYCwifuB2T7aGUx8C csiopF7iiWs5ZLWMFT4+Mp42YHB3xnvnl0+FJVSlKDevBeBICp1HiaWOx3112I5N0hpM= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1396 Lines: 44 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, 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/