Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6229621ybv; Wed, 12 Feb 2020 08:19:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxr/SXR60w9ho9GwNffD8z0Jj418Xdl8q+3L++U7F2iK3m63pzEG5ROIlSMSaYbVkERZR2z X-Received: by 2002:aca:cf52:: with SMTP id f79mr6879135oig.129.1581524358244; Wed, 12 Feb 2020 08:19:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581524358; cv=none; d=google.com; s=arc-20160816; b=uknPuHithQFOd7Wh8Q8LRbIyJ/31CfzzyyUDtchZ96VexoLNXpGSjbgT6JrgxOwA0F T2j5bKwL1L+WLOQexdSfvUF7ytdb28sWAZMuWjTEL6Nuy48I1pmHzFONpUa30jHqzMsi toQbulFXMBs9HEP1jJubuHaGd9NqOSzzdE8CAY0AZLDRnKEBRjwBdz+Fw1ngcnbvRmGz 9lwdXKHom95RajJleI9VJSFadjPAvsDao2o7KcwNAWxgB7LJybIARjUVOD9TwHVd6HT0 FMBSwcoLqt1NqbhOVkslaepioaqMYPb8STIDIp1Ly1UdkSHgRtfXGRjtrcdBa8TvQr6y JvFQ== 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:date:subject:cc:to:from; bh=Wk1oKYmmuSL0SGHBsxBcfU2N8/brza0S2lDV/PHDjOY=; b=uWXN8LFxl5bRwx44p0GrHeGqamc4goJR70NvUUCtPwRKK9Pe8WUH7OSw/P+0Rew27x Qj8+N4LAAuoJR0EYg0CF9Lh5uO4X8kqrYp/jzbETwwS2slxG64HqSvItO0FMvAvdvyDz NKK315z2ZbslcHd6ieNB/9qqCTtM/zFrb9+OP9OJEK24CxAW6WavkSdXskiDvVD/11+o Tl0sV5gMX8nhsIiDTbA98N00FYHzwAHsLwK7M6XIMwN+eETFD3rOkCdtW+I9NKws5OTa erpTRXxdvp3qSfx6VALfO4WE91oaxZsldGPxHdvM6ud8hYFSdXNvBReKavCwTwKbA3/3 lW/w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o206si3584334oih.143.2020.02.12.08.18.57; Wed, 12 Feb 2020 08:19:18 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728665AbgBLQSG (ORCPT + 99 others); Wed, 12 Feb 2020 11:18:06 -0500 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:36876 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbgBLQSC (ORCPT ); Wed, 12 Feb 2020 11:18:02 -0500 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01CGENMI001203; Wed, 12 Feb 2020 11:18:01 -0500 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com with ESMTP id 2y1udmyfnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 11:18:01 -0500 Received: from SCSQMBX10.ad.analog.com (scsqmbx10.ad.analog.com [10.77.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 01CGHxhP052876 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Wed, 12 Feb 2020 11:18:00 -0500 Received: from SCSQCASHYB6.ad.analog.com (10.77.17.132) by SCSQMBX10.ad.analog.com (10.77.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Wed, 12 Feb 2020 08:17:58 -0800 Received: from SCSQMBX11.ad.analog.com (10.77.17.10) by SCSQCASHYB6.ad.analog.com (10.77.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Wed, 12 Feb 2020 08:17:34 -0800 Received: from zeus.spd.analog.com (10.64.82.11) by SCSQMBX11.ad.analog.com (10.77.17.10) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Wed, 12 Feb 2020 08:17:58 -0800 Received: from tachici-Precision-5530.ad.analog.com ([10.48.65.175]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 01CGHsf7001230; Wed, 12 Feb 2020 11:17:56 -0500 From: Alexandru Tachici To: , CC: , Alexandru Tachici Subject: [PATCH v3 1/5] staging: iio: adc: ad7192: fail probe on get_voltage Date: Wed, 12 Feb 2020 18:17:17 +0200 Message-ID: <20200212161721.16200-2-alexandru.tachici@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200212161721.16200-1-alexandru.tachici@analog.com> References: <20200212161721.16200-1-alexandru.tachici@analog.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ADIRoutedOnPrem: True X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-12_08:2020-02-11,2020-02-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=928 lowpriorityscore=0 clxscore=1015 mlxscore=0 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002120125 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.20.1