Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1885773ybv; Fri, 14 Feb 2020 07:41:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyCQSnx7deFi33SzyYKK/wOGj+Q76FLcFriG4RCtRNuYjoH0aBy50ufjmcSD0i7wq7Mh8Uk X-Received: by 2002:a05:6808:191:: with SMTP id w17mr2200733oic.29.1581694876542; Fri, 14 Feb 2020 07:41:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581694876; cv=none; d=google.com; s=arc-20160816; b=u6GKfP3Sc/kjAkF/cfblhQH+Ppad8m3+LgrYQ5t5zoAn0Vx+Ul0FfKVaoLiUOumQib tuV7moUQYBNhAcAod0btR2/cOAnlABViOmwAFpidpcOSeO1KlbjhL0jb3FoxryrqVIxf IjhsaF31eIDmnlhQ0oGr0BsX2XpI4eUJU+PU3ZFstEIzXC8ttxQhDLlk/O6ST59uyTr0 gPLBjTx3rQrQhxQpl5vW7Y4lwolNB9y6tswIfO380i4uassXLMXHlzKerUYtJMJlq2+Z v6JMCN45femWUtXfacN7T8Nk+F71rp9MhoPQGGwdxs6VvhLxQoImQAkn6qjkzsQPYdwf 5C0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SE9KsQZ+tTYlPBmQRNyW+GUFkNQgd7C/d5EfWaiz49E=; b=qsKTnJ8qBoD/gDo8VyEzvj4HKISFli64MjuEneXnXFFxulIdaz8Y9QEIg70bCaGrcf ohMVWNdgVPB+qr1esMpPpzEMrnNeOD5hJxSynqFOFu9MLy07P0d8loi8OVg3thLk83tW hWvfepKKMr6OKIR5vT9JL8vz5BGyO8ZJSnlMEX4nj60x5i77mp/C8r4fOF6uP8FxEROf KZzepZWkFfVe9qVuKZUItGzGRYqDOFtlaOWdCI+D3J8tYif/SFt/oTYZB4A170Kt71lk uaj28JS4NJPSbhqX8LTbAZivRaOXSdbw7KCbWkz+5wpDILxGnw2hQsSKENfDS55Lzbmq YlKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dw/uu2/O"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24si2975652otn.125.2020.02.14.07.41.04; Fri, 14 Feb 2020 07:41:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dw/uu2/O"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729543AbgBNPk4 (ORCPT + 99 others); Fri, 14 Feb 2020 10:40:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:47760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729439AbgBNPk4 (ORCPT ); Fri, 14 Feb 2020 10:40:56 -0500 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DAB72467D; Fri, 14 Feb 2020 15:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581694856; bh=v+owP3ISw49O9bIkXyz/Z8SVlg482uuJFZRpP3SjwZk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dw/uu2/OPxIJNPP8VUXDeP9Sc2WVGmzRPoWs4iuQKali0vUWF+VTJelxUBa2aTZoi 2Dgp+74o2WzDNNZyrGtSBwgQ26SMMu6XPai2Dcoe5kwrRsMc+WbfVsaMMVwlY35Odw pZdhpHHsNcPSWtMwwTqgbIp5znmx5Mch57Th72QY= Date: Fri, 14 Feb 2020 15:40:51 +0000 From: Jonathan Cameron To: Alexandru Tachici Cc: , Subject: Re: [PATCH v3 1/5] staging: iio: adc: ad7192: fail probe on get_voltage Message-ID: <20200214154051.3aa1d09a@archlinux> In-Reply-To: <20200212161721.16200-2-alexandru.tachici@analog.com> References: <20200212161721.16200-1-alexandru.tachici@analog.com> <20200212161721.16200-2-alexandru.tachici@analog.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Feb 2020 18:17:17 +0200 Alexandru Tachici wrote: > This patch makes the ad7192_probe fail in case > regulator_get_voltage will return an error or voltage > is set to 0. > > Signed-off-by: Alexandru Tachici There are some corner cases around this that we may meet in the future. Particularly if someone uses a variable reg to provide this voltage. However, we can fix those when we come to them. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > drivers/staging/iio/adc/ad7192.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c > index bf3e2a9cc07f..41da8b4cdc48 100644 > --- a/drivers/staging/iio/adc/ad7192.c > +++ b/drivers/staging/iio/adc/ad7192.c > @@ -899,10 +899,13 @@ static int ad7192_probe(struct spi_device *spi) > > voltage_uv = regulator_get_voltage(st->avdd); > > - if (voltage_uv) > + if (voltage_uv > 0) { > st->int_vref_mv = voltage_uv / 1000; > - else > + } else { > + ret = voltage_uv; > dev_err(&spi->dev, "Device tree error, reference voltage undefined\n"); > + goto error_disable_avdd; > + } > > spi_set_drvdata(spi, indio_dev); > st->devid = spi_get_device_id(spi)->driver_data;