Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1832874yba; Sun, 7 Apr 2019 01:23:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZzrOEvM8MK8QuKbY/hn7Syv5zdQVXwf68BTiS+YQQcsg/4FH89YNn1GE3tA8tKJ2I2a2m X-Received: by 2002:a63:6503:: with SMTP id z3mr17427319pgb.113.1554625393227; Sun, 07 Apr 2019 01:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554625393; cv=none; d=google.com; s=arc-20160816; b=Cy3n/R4Lpoo5LQrR0O/MTA3rBN48GgXb9gQXw4//5oQVaYwAJq52CtoLmuR9H5vbm3 YFzjnxUJ4lMwDufa1gVJ1Upyk3Q/mQWuYE0BuWCgjQnZCKZvar55TV1uDvk5kIbZf53f L7lkt2pgX/z1S444xSfjhATXAcA3ZkfRXOmTevnzUMQs4aVSiopMWJc8u4w89OTIK8vW KNqEZQVFKSnmc/4GRKlDtE1OyWsDfra5WF7lvhiBbtNMTqBhw2wP6p4M6CGvgry0Ehkf BZG73y6NWKXRI/Y94Aco7t6waf+d6LGPJswfu+Z1LB0V4DtTcwfmD/mr0Ln3K9Ka9Tzd vcQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=WIXuic1AzMUSEIdW9IQOT0YWCgKJIi8o86yuuhH2SrU=; b=QAk2cJzoEusjMegIE05M0Yg0hcEU8s3KLVrk/bRufW3XTO3gjiSqGONUC3ejqOQlJM fQpRzBj02CVabi9hOBqfRMy+7tETAS1/2JF2AGIAvv7sDqE8bx1NRB/EyQWoeLvCFOjO vrgRVAoqAIw2vXcYbUKDQN885Y6aeja2SNnyaTZIS6bljlXS3ALNMg0+/l4xqWBKRNPk yPW9J5I44AsLoU9x0U8Op5j7l8Tfyzj8n5v3ojAQg5TFPTS/zCb/JDMNp0Cdb/oV1ZaX HzA5T+loXZREjIhvUdaGa9ewZOZ3xrRIufBE+x4hjAASM+1xTbaX3nKqL9Rp+2rK0YVQ 8S+A== 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si5646125plf.43.2019.04.07.01.22.46; Sun, 07 Apr 2019 01:23:13 -0700 (PDT) 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726199AbfDGIUr (ORCPT + 99 others); Sun, 7 Apr 2019 04:20:47 -0400 Received: from 212.199.177.27.static.012.net.il ([212.199.177.27]:32849 "EHLO herzl.nuvoton.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725966AbfDGIUr (ORCPT ); Sun, 7 Apr 2019 04:20:47 -0400 Received: from taln60.nuvoton.co.il (ntil-fw [212.199.177.25]) by herzl.nuvoton.co.il (8.13.8/8.13.8) with ESMTP id x377nY46006873; Sun, 7 Apr 2019 10:49:34 +0300 Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 1F71763000; Sun, 7 Apr 2019 11:19:31 +0300 (IDT) From: Tomer Maimon To: gregkh@linuxfoundation.org, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, yuenn@google.com, venture@google.com, brendanhiggins@google.com, avifishman70@gmail.com, joel@jms.id.au Cc: linux-iio@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Tomer Maimon Subject: [PATCH v1] iio: adc: modify NPCM ADC read reference voltage Date: Sun, 7 Apr 2019 11:19:28 +0300 Message-Id: <20190407081928.72250-1-tmaimon77@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Checking if regulator is valid before reading NPCM ADC regulator voltage to avoid system crash in a case the regulator is not valid. Signed-off-by: Tomer Maimon --- drivers/iio/adc/npcm_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c index 9e25bbec9c70..193b3b81de4d 100644 --- a/drivers/iio/adc/npcm_adc.c +++ b/drivers/iio/adc/npcm_adc.c @@ -149,7 +149,7 @@ static int npcm_adc_read_raw(struct iio_dev *indio_dev, } return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: - if (info->vref) { + if (!IS_ERR(info->vref)) { vref_uv = regulator_get_voltage(info->vref); *val = vref_uv / 1000; } else { -- 2.14.1