Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2778839rdb; Mon, 4 Dec 2023 07:20:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVaChT3anDWV5OUAQVQdsVXpdWvXDB4mUlIwOk3K+uS95gVm6nsztV7N8TvWeNtQSR9deE X-Received: by 2002:a17:90b:33c2:b0:286:b271:b96d with SMTP id lk2-20020a17090b33c200b00286b271b96dmr1029298pjb.32.1701703212083; Mon, 04 Dec 2023 07:20:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701703212; cv=none; d=google.com; s=arc-20160816; b=yTbxo3X2mHjbbX9VivRZxlfXSziRT+f5CRzV2L52eGTEuvGdoTVHbQc2F4MfSgT0Gp 9Gz9rY7Q2FdX1bdwBQNjG1Ei4uKXai+1CdL/eIw/X4jl7E5/sg5LDx8WAcLELH+jbxV/ jOWxslC0cnGuYbCliMiKjpxxFW4/cGoq3lPz3iLq/tBG77WTAUCC2qYg3WYvkAD7ZyRQ iag2R9u7lwWpWiHH7wlK1mmsaAHD/ccSquC8GGeD1coSpjHHO8Le4o3eKU3VEb6jdWtF wtulZwoT24Ne9ZImZcEx8ag39iFnfQkszJHM4ZqHhHQV8UqOOnCpDgKQ07ewUWGPCtS6 xGiw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9oqoNMl/i6Kn+HLrKhtW2DKUw275mEEcU/QEMFVq45M=; fh=cdh/zE3CZkKBVPpwlAi1MOirEcAUajw2fxcnBBQCP7U=; b=Mfat3vv/XqFwKZTHij8CUwm3Iqj+nQEX8Zp83iZ3hHFjWqiWcAuZKN6qbfCBlevDUM of+anIjbxxPUBsvdck7R3J1aPNQea939bzk2SZqgoFk996RVlsUj6hgSwGeKcPhAS0XW BNnfkK9PoNjQZulCDessl02TBCg9OTsa39IS+WXE8ngz7ypdxsyhzv1bkPAH5fstTxfJ oyocQ8ntmCypz7aMhiHlW7OXXxQzzRNCYP+fJMjlI9qw97mA7CjxHv5tJIV3kc2E3uBs JTZrg9EOrBXauTNycHSwJtLD45R6V+6XZZmkChBHH2rxywoqsxQ1+Nj6T1m2LeHcapji QNDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YousOfmM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i4-20020a17090ad34400b0027d113631f0si6338387pjx.24.2023.12.04.07.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 07:20:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YousOfmM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D5FFA8049D53; Mon, 4 Dec 2023 07:20:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234642AbjLDPTV (ORCPT + 99 others); Mon, 4 Dec 2023 10:19:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234432AbjLDPTT (ORCPT ); Mon, 4 Dec 2023 10:19:19 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BD14F0 for ; Mon, 4 Dec 2023 07:19:21 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F5EFC433C8; Mon, 4 Dec 2023 15:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701703160; bh=5sEvSdS3ZKittuPMVcViM6IheLlMNVV6ts0oVk77otY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YousOfmMHBUnvlRCr32wRy8FZAF1dTCiHuVIv7Kp2hghkRxjzn4MqQ2IV42kUi7mm O9QiotGnaRLRKMgVT9kSHYI+B0kNX5sGLb3YOcF/kzMaCF31Y2xt0yqhBWBqIRMDWq uq5Arw2zDAQiMqdZtJirTTKNWaFMN4ppVhJsgzYHfyspehGngnpOAabogB9WgdXQnn O0L+CzECjLKWu7s6MDvRCZY1fhRKbvtqjh7ujY9+PsMOHqFuWPemkJgn6KTSvMlH2b Yjqm/OreLE8I7rJN96gXBgSlgoMwvs2dcppvhwEqvWaOMXxt3EldipR0L6XUx4VriV gXJgWFPGyGguw== Date: Mon, 4 Dec 2023 15:19:10 +0000 From: Jonathan Cameron To: Nuno Sa via B4 Relay Cc: , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Olivier MOYSAN , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Lars-Peter Clausen , Michael Hennerich Subject: Re: [PATCH 05/12] iio: adc: ad9467: don't ignore error codes Message-ID: <20231204151910.6ab1728f@jic23-huawei> In-Reply-To: <20231121-dev-iio-backend-v1-5-6a3d542eba35@analog.com> References: <20231121-dev-iio-backend-v1-0-6a3d542eba35@analog.com> <20231121-dev-iio-backend-v1-5-6a3d542eba35@analog.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 04 Dec 2023 07:20:08 -0800 (PST) On Tue, 21 Nov 2023 11:20:18 +0100 Nuno Sa via B4 Relay wrote: > From: Nuno Sa > > Make sure functions that return errors are not ignored. > > Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC") > Signed-off-by: Nuno Sa > --- > drivers/iio/adc/ad9467.c | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > > diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c > index 368ea57be117..04474dbfa631 100644 > --- a/drivers/iio/adc/ad9467.c > +++ b/drivers/iio/adc/ad9467.c > @@ -6,6 +6,7 @@ > */ > > #include > +#include David noted this one... > #include > #include > #include > @@ -160,11 +161,12 @@ static int ad9467_reg_access(struct adi_axi_adc_conv *conv, unsigned int reg, > struct spi_device *spi = st->spi; > int ret; > > - if (readval == NULL) { > + if (!readval) { Nothing wrong with tidying this up if the !readval syntax is more common in the driver, but it doesn't have anything to do with the fix, so not in this patch. > ret = ad9467_spi_write(spi, reg, writeval); > - ad9467_spi_write(spi, AN877_ADC_REG_TRANSFER, > - AN877_ADC_TRANSFER_SYNC); > - return ret; > + if (ret) > + return ret; > + return ad9467_spi_write(spi, AN877_ADC_REG_TRANSFER, > + AN877_ADC_TRANSFER_SYNC); > } > > ret = ad9467_spi_read(spi, reg); > @@ -274,6 +276,8 @@ static int ad9467_get_scale(struct adi_axi_adc_conv *conv, int *val, int *val2) > unsigned int i, vref_val; unsigned and you check it for < 0 .. > > vref_val = ad9467_spi_read(st->spi, AN877_ADC_REG_VREF); > + if (vref_val < 0) > + return vref_val; int ret = ... vref_val = ret & info1->vref_mask; if not an error. > > vref_val &= info1->vref_mask; > > @@ -296,6 +300,7 @@ static int ad9467_set_scale(struct adi_axi_adc_conv *conv, int val, int val2) > struct ad9467_state *st = adi_axi_adc_conv_priv(conv); > unsigned int scale_val[2]; > unsigned int i; > + int ret; > > if (val != 0) > return -EINVAL; > @@ -305,11 +310,13 @@ static int ad9467_set_scale(struct adi_axi_adc_conv *conv, int val, int val2) > if (scale_val[0] != val || scale_val[1] != val2) > continue; > > - ad9467_spi_write(st->spi, AN877_ADC_REG_VREF, > - info->scale_table[i][1]); > - ad9467_spi_write(st->spi, AN877_ADC_REG_TRANSFER, > - AN877_ADC_TRANSFER_SYNC); > - return 0; > + ret = ad9467_spi_write(st->spi, AN877_ADC_REG_VREF, > + info->scale_table[i][1]); > + if (ret < 0) > + return ret; > + > + return ad9467_spi_write(st->spi, AN877_ADC_REG_TRANSFER, > + AN877_ADC_TRANSFER_SYNC); > } > > return -EINVAL; >