Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1004836rwb; Fri, 13 Jan 2023 06:52:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYVosaL0fVzL+rJIrmPeCgBis0R4czX14usl1BtOkJhMvsngQuLQU1tpXvZQ+F42Y1el9b X-Received: by 2002:a62:154f:0:b0:581:3557:f75b with SMTP id 76-20020a62154f000000b005813557f75bmr11302997pfv.5.1673621533410; Fri, 13 Jan 2023 06:52:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673621533; cv=none; d=google.com; s=arc-20160816; b=P1iY/J0GBG0cvG15vP5R0ovEtpIU1S4OLzT9TVn54g0AUYee/kjmWDOOelr8xetjJr 5QAeXzAv9lxHsi6UU7IEcQVVCp7H7XUtQ4DGumXRhhHdwGUdgaZdmMyozS9IPZiFtumU ePQjfiWxes3tyys6FB7tUFvmW64dcFlEzNCXjdQaL1aaDLgVHTei/6PnSltu7IBwKPeh ApvnCQ2KwMaMGa/b62mJfTTPuBGHalPAu2yg/ZXYIt/xwE/xsn/6guEYQNfWlbAGlFI5 mhlQlvlE2vnRuLl5aFURKmG02zX2dO6wzNLNf3KpBAmV50qp89kWcsCqW0mZ4IOoE0j7 XEfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=C4Su5sDjvJoxPqZIrOPMui7n2i8VeNIg2MPVdWvNwvI=; b=iHHUSiqN7rtM7Uua3dYx3JhOoaG7hAYdcoA8rF56kZVsUJ1Ksiv5TYD29lFGkBZRqI Kkc7VWvGTPnHpJ77akR2viXRZC2krnq75IaNAPENx8BakuiyFVrlsYt7qIFtBuJZIa2I +iHpdOCOFqlRcjUd54ObEbx2NYJgZJARZuUlvyJVSq8w0mNVsGNEEE5KxMgwlYDQyEId J5RBaSYbH9K524SSxZ+V9m4WLH6ORaLuQBiJDV7hnTpgxC9Df44tDNUae4LHkpa4Oh+b g52KJKKpQeLE4WKT5X6vExShi8yYmGR2bLtF1FPqcqRfdgH5rZrXN8RsAOp1MazkZqHR ykEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q27-20020aa7961b000000b0058bc2e7766asi305040pfg.222.2023.01.13.06.52.07; Fri, 13 Jan 2023 06:52:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbjAMO0z (ORCPT + 53 others); Fri, 13 Jan 2023 09:26:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbjAMOZo (ORCPT ); Fri, 13 Jan 2023 09:25:44 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D63E11D0EB; Fri, 13 Jan 2023 06:17:07 -0800 (PST) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Ntk4J5kGHz67bbZ; Fri, 13 Jan 2023 22:16:32 +0800 (CST) Received: from localhost (10.81.201.219) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 13 Jan 2023 14:16:41 +0000 Date: Fri, 13 Jan 2023 14:16:40 +0000 From: Jonathan Cameron To: Hugo Villeneuve CC: Jonathan Cameron , , , , , , , Subject: Re: [PATCH v2 1/2] iio: adc: ti-ads7924: add Texas Instruments ADS7924 driver Message-ID: <20230113141640.00006fb1@Huawei.com> In-Reply-To: <20230112143357.6d6204f19eb622333bfd2f47@hugovil.com> References: <20230110160124.3853593-1-hugo@hugovil.com> <20230110160124.3853593-2-hugo@hugovil.com> <20230112190030.37b9ea2f@jic23-huawei> <20230112143357.6d6204f19eb622333bfd2f47@hugovil.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.81.201.219] X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > + break; > > > + } > > > + case IIO_CHAN_INFO_SCALE: > > > + vref_uv = regulator_get_voltage(data->vref_reg); > > > + if (vref_uv < 0) { > > > + /* dummy regulator "get_voltage" returns -EINVAL */ > > > + ret = -EINVAL; > > return -EINVAL; > > > + } else { > > > + *val = vref_uv / 1000; /* Convert reg voltage to mV */ > > > + *val2 = ADS7924_BITS; > > > + ret = IIO_VAL_FRACTIONAL_LOG2; > > return IIO_VAL_FR... > > > > > + } > > > + break; > > > + default: > > > + ret = -EINVAL; > > return -EINVAL; > > > + break; > > > + } > > > + > > > + return ret; > > > +} > > Done. With these changes, I propose to also remove last "return ret" (like in rcar-gyroadc.c). Then, maybe also remove break statements? Definitely to both. I was just being lazy whilst commenting ;) No breaks after returns, and as you have noted, the last return ret is unreachable. > > > + > > > + if (num_channels > 0) { > > > + dev_dbg(dev, "found %d ADC channels\n", num_channels); > > > + return 0; > > > + } else { > > > > As per other review. Give us what we expect which is error paths > > as out of line. > > Already done as suggested by Christophe: > > if (num_channels <= 0) > return -EINVAL; This is an out of line error path because it's indented more than the normal flow. > > dev_dbg(dev, "found %d ADC channels\n", num_channels); > return 0; > > Although I do not fully understand what you mean by "...error paths as out of line"? Do you mean to drop the debug message? See above. > > > > > > + return -EINVAL; > > > + } > > > +}