Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4197743pxj; Tue, 11 May 2021 23:29:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj9pKqJ/hBM7c/2VcbD5OkH+kUD6wriwCb8OOxsSXiNNGsBHm5jDaFox4J+MnS9tT6GxQy X-Received: by 2002:a6b:6008:: with SMTP id r8mr25626682iog.125.1620800980732; Tue, 11 May 2021 23:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620800980; cv=none; d=google.com; s=arc-20160816; b=onMZ8di04YXEo+tc0uy32BhVLVq3CjQ6HwKg3Iwrren0lGizSctSMmFnu2HjyCBe6m 1ofe7el4ZlpOkNOEgC90RiNhPshslDSqKVPFMjvqyGLLR8uzmoLUWcgCdckVPxH7gyQ8 J7hr2kfxyPnLG58M+MC0hux8ev77hO2PtTx0j5SKst9PrUngz9yuADMd1IzwxyWCgjon 8e2pHB88geJZILdU6dVwGppkh6N8L/jeCx9CTiAsN3RHkd3qwXarljv7fYhaliFt+/NZ wJtcTx/GEPn9eHdcOkMkn4FeewMuBULESN1lDFcQq71Upk9n5fNRyKJOkfhWUOVsxb8P 3tCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4UwPaiMvT71jZjZxQi+bCQNJCogOTLRNHtxmsH4BW50=; b=kZm36/NsfzP4G8YxEFIiCEmp8ybzYbYxUjsxE2p+R/7H18RkSC/rqHLaEHS20/CrXw uDfarrQEfmLBnun3L1CJ605JOgbquGY4i2MQ6YgG4QXGkr8HUBpoDTRcQ0tF3IBgk/FG TjBTmuoVxEC4tqC03FL/Cqt+/hjD3/YQ00xxKqUrWRgCqqVQoMOqJw+/wPL8sOkArvdi wqvql0YbT8ICx9zVT1EWqB9eILv0Btja3QeF2RTu1dn4XDGqhKJryn4kq7IhNjsefDBK SxT3LP2Uxs/HnCDBA/WRF2PZFUc1z+ys0fbpKg6Gqvhfp4788wMrbFEIp1Xn6YnTjRoK z/4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=d7RU5qCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o8si21712728ilu.133.2021.05.11.23.29.27; Tue, 11 May 2021 23:29:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=d7RU5qCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229654AbhELGaB (ORCPT + 99 others); Wed, 12 May 2021 02:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbhELGaB (ORCPT ); Wed, 12 May 2021 02:30:01 -0400 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC05EC061574 for ; Tue, 11 May 2021 23:28:53 -0700 (PDT) Received: by mail-vs1-xe2b.google.com with SMTP id x17so7131545vsc.0 for ; Tue, 11 May 2021 23:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4UwPaiMvT71jZjZxQi+bCQNJCogOTLRNHtxmsH4BW50=; b=d7RU5qCrJDkEmIQMPHye1G5TVdNusfGm+NTUX5fTO4/eJOtrKm4FvEy+/5f94acZyl IuIdA/BinCUwI0yZUpfGK1vzwW1P7K4I4xMVqdf6iHuh97Jgn/mQ/TKVDZ3OBeyAJ32f g/rhQijVOHTYqFy2et4D1inpQO/415khcRiAWo+pxnUG3wtEMi3vmD2Fiwx7Ip77IHOn /X2K3X4ouu+cV27gxCg1ySUFMxsVTiuDZ0tO1T7oj5Onl7fVpoKCsVuzAkYn/tF/S3ii DQDYTv/kJGNpHFZNWAfctmz80ByQgXxzAjUAfQG5y+KMsGroeFkY4/T8H4JDFp0hg1Ga 2H/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4UwPaiMvT71jZjZxQi+bCQNJCogOTLRNHtxmsH4BW50=; b=LyYyaS4TYZ11lht6wWAkcCEkfDOxUE9LmYwQ3MxeBZwLHhAVNKB3xIoFjhLXz766JT f2cwu3aZb1jCxUrMDvqqdae2iddF32tbYbAYSvHYK9041dSRavudiZFUm8oS8WhPlRob miGqIeIY0YhqoNXnCyaqGQyxq7rrlDPT9tukaP02SmHfx6cURTTK2yB1O2/RZUJ3DzXv hOHMV6yxHwvhQaYYgPK8LDc6F6cc/k1Fw3No4MeqlrKHNbUFupiAB/kkQ0rWNrfqVWbY dWxYtFrGkDMfvBqf6zDDJdnIg/iHoeMQja6wZx2sDS5MwbCVbCoat8nGWHC/vSeOp0Ii iDMg== X-Gm-Message-State: AOAM531aXULlJDIIkKgNCeT5todwDiXJv+40sGPhHqC7aYWmUx7kyqHf OxTA0BIenwf0t+dyWceC1Lt+36wZDUOP3XAm+nvqaw== X-Received: by 2002:a67:db91:: with SMTP id f17mr30048675vsk.47.1620800932800; Tue, 11 May 2021 23:28:52 -0700 (PDT) MIME-Version: 1.0 References: <20210511071831.576145-1-aardelean@deviqon.com> <20210511071831.576145-5-aardelean@deviqon.com> <20210511151323.30832207@jic23-huawei> In-Reply-To: <20210511151323.30832207@jic23-huawei> From: Alexandru Ardelean Date: Wed, 12 May 2021 09:28:41 +0300 Message-ID: Subject: Re: [PATCH v2 04/12] iio: adc: ad7192: handle zero Avdd regulator value as error To: Jonathan Cameron Cc: linux-iio , Linux Kernel Mailing List , Jonathan Cameron , alexandru.tachici@analog.com, linux@deviqon.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 May 2021 at 17:12, Jonathan Cameron wrote: > > On Tue, 11 May 2021 10:18:23 +0300 > Alexandru Ardelean wrote: > > > This change fixes a corner-case, where the returned voltage is actually > > zero. This is also what patch ab0afa65bbc7 ("staging: iio: adc: ad7192: > > fail probe on get_voltage") was trying to do. > > > > But as Jonathan pointed out, a zero-value would signal that the probe has > > succeeded, putting the driver is a semi-initialized state. > > > > Fixes: ab0afa65bbc7 ("staging: iio: adc: ad7192: fail probe on get_voltage") > > Cc: Alexandru Tachici > > Signed-off-by: Alexandru Ardelean > > Given that voltage_uv == 1 would result in a situation no worse than > for voltage_uv == 0 perhaps we should just change the following condition to > > if (voltage_uv >= 0) ? hmmm, you're right; i think had some narrow vision about this; will send a v3 > > Jonathan > > > --- > > drivers/iio/adc/ad7192.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c > > index d3be67aa0522..79df54e0dc96 100644 > > --- a/drivers/iio/adc/ad7192.c > > +++ b/drivers/iio/adc/ad7192.c > > @@ -950,6 +950,11 @@ static int ad7192_probe(struct spi_device *spi) > > } > > > > voltage_uv = regulator_get_voltage(st->avdd); > > + if (voltage_uv == 0) { > > + ret = -EINVAL; > > + dev_err(&spi->dev, "Zero value provided for AVdd supply\n"); > > + goto error_disable_avdd; > > + } > > > > if (voltage_uv > 0) { > > st->int_vref_mv = voltage_uv / 1000; >