From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A5E0C2D0DB for ; Mon, 27 Jan 2020 12:06:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6923D20CC7 for ; Mon, 27 Jan 2020 12:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729551AbgA0MGJ (ORCPT ); Mon, 27 Jan 2020 07:06:09 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:2297 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728981AbgA0MGJ (ORCPT ); Mon, 27 Jan 2020 07:06:09 -0500 Received: from LHREML713-CAH.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id BBBD5E1D91C9EC7A5529; Mon, 27 Jan 2020 12:06:07 +0000 (GMT) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by LHREML713-CAH.china.huawei.com (10.201.108.36) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 Jan 2020 12:06:07 +0000 Received: from localhost (10.202.226.57) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 27 Jan 2020 12:06:07 +0000 Date: Mon, 27 Jan 2020 12:06:06 +0000 From: Jonathan Cameron To: Eugene Zaikonnikov CC: Jonathan Cameron , Eugene Zalkonnikov , Hartmut Knaack , Lars-Peter Clausen , "development@norphonic.com" , "linux-iio@vger.kernel.org" Subject: Re: [PATCH v3 1/2] Driver for TI HDC20x0 humidity and temperature sensors Message-ID: <20200127120606.00003931@Huawei.com> In-Reply-To: <9d866c18-6643-f76f-df7e-6f29f01274da@norphonic.com> References: <20191223171627.1179f88b@archlinux> <9d866c18-6643-f76f-df7e-6f29f01274da@norphonic.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.57] X-ClientProxiedBy: lhreml737-chm.china.huawei.com (10.201.108.187) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Tue, 21 Jan 2020 08:45:21 +0000 Eugene Zaikonnikov wrote: > Hi Jonathan, > > > On 23.12.2019 18:16, Jonathan Cameron wrote: > > > > As below. Why change the existing return value? > > > >> + } > >> + return ret; > >> + } > >> + case IIO_CHAN_INFO_PEAK: { > >> + int ret; > >> + > >> + ret = iio_device_claim_direct_mode(indio_dev); > >> + if (ret) > >> + return ret; > >> + mutex_lock(&data->lock); > >> + ret = hdc2010_get_measurement_byte(data, chan); > >> + mutex_unlock(&data->lock); > >> + iio_device_release_direct_mode(indio_dev); > >> + if (ret >= 0) { > >> + /* Scaling up the value so we can use same offset as RAW */ > >> + *val = ret * 256; > >> + ret = IIO_VAL_INT; > >> + } else > > Why overwrite ret? That might provide better information > > on what went wrong. > > As with the other stylistic notes before, no good reason other than how it was handled in other drivers in the tree. So I assumed it was the practice. Will tidy up later this week I hope and send a new patchset. We should look to clean up any cases where a valid error code is overwritten with no good reason. I thought we were pretty good on that generally but there may be some still hiding in various drivers. Thanks, Jonathan