Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2657957pxa; Mon, 17 Aug 2020 15:44:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw63/at215ErDtmzIqPFQfhhu6UEpxsxVyJglLA+dND8N+/giDNQPubKU7ZOaJAlnMXuzHH X-Received: by 2002:a17:907:372:: with SMTP id rs18mr16761419ejb.146.1597704270151; Mon, 17 Aug 2020 15:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704270; cv=none; d=google.com; s=arc-20160816; b=MmDx935XScFS3fIBtAflW0uvmczl4f16rm9MeRimAG/xPCLJ1HY8WwNKO0sw0Y89VK BH8aWytIH+wMF0MYv1LX637jQK5wGh4Yeudvl94O8POj2bZwDzaQGGhNCFLfBHBGZbdb aN0iLwerXCCYlPLUlQoZbs/XoTMVeHpQ3uYYtRjoh8aSC45lUZRTn/Dy3/M9R1l9OSel liwAZ+rIWyf9Ok6IGfo6rn2uksy6wDfhfAoNtEqZ7ifclXhhuC031+Smp25srz7CyBvQ PQKLzmjtVtCrBhIokgjouZgrhAv6tErdl3uYIxqZBoT1/wndte+bqUTDkVuS1KTBB7uJ 8qkQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RkVyPj+wQF0S1GAejRiL2sho4762ufSlQtCEj6r2HtQ=; b=enrUuoDlTqxkQMBGaWjRib+ihyU/1iQt3MKbVV+vXAZ/Mlv5Gg5CMK6vumqCMrmM3H PY64YrxAAofJ8MfkpNtOeUj6r56Pe4DWsJ/bF7BzULN+8LXFFP5dHaRSSPo+vYRiZscI hC+4R7lZD4JQwZGhHO2IRjGzvVYcCwlWHwxvxieODxNOnf5i6bPZGU7ldttb6N2Q2olK 3sx/kIbk/oPv3QUDGWyBkS/aX54kGmJ1waqZkrvqOWkA/Xe5VPSvAdZwja4KlqPwQPnc f/h8IIV9XcbSFf4628KahQZI/0ZXsSwwd/OaSd80G6okCjNPZY2bSHdUiaROlr8pPxAt Cfng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2AAejbyA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si14521433ede.295.2020.08.17.15.44.06; Mon, 17 Aug 2020 15:44:30 -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=@kernel.org header.s=default header.b=2AAejbyA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404040AbgHQTCh (ORCPT + 99 others); Mon, 17 Aug 2020 15:02:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:59368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730816AbgHQPrU (ORCPT ); Mon, 17 Aug 2020 11:47:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 5660820885; Mon, 17 Aug 2020 15:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679233; bh=h+tYd+bZNAwHmeZmlBWeOiSqa8F/jt2io4cs8+AGino=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2AAejbyAg3Wq/UJ0gTMxmkIEBVU0o2lVP9JFDyRepBA9dAIAI6Fhyun5AR+p9LPXO RqbFAVHTb8HtKqNiTg/vdy0ftbRrUQ7k6oNYclf0JLT5BVOosWih+onF7x5R2NA0Xs py8N1BVJSyFthSFbmGnwKmMw/kN0Ft/k5x9teMBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Alexandru Ardelean , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.7 141/393] iio: amplifiers: ad8366: Change devm_gpiod_get() to optional and add the missed check Date: Mon, 17 Aug 2020 17:13:11 +0200 Message-Id: <20200817143826.449126537@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuhong Yuan [ Upstream commit 9ca39411f9a9c833727750431da8dfd96ff80005 ] Since if there is no GPIO, nothing happens, replace devm_gpiod_get() with devm_gpiod_get_optional(). Also add IS_ERR() to fix the missing-check warning. Fixes: cee211f4e5a0 ("iio: amplifiers: ad8366: Add support for the ADA4961 DGA") Signed-off-by: Chuhong Yuan Acked-by: Alexandru Ardelean Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/amplifiers/ad8366.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c index 62167b87caea8..8345ba65d41d8 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -262,8 +262,11 @@ static int ad8366_probe(struct spi_device *spi) case ID_ADA4961: case ID_ADL5240: case ID_HMC1119: - st->reset_gpio = devm_gpiod_get(&spi->dev, "reset", - GPIOD_OUT_HIGH); + st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(st->reset_gpio)) { + ret = PTR_ERR(st->reset_gpio); + goto error_disable_reg; + } indio_dev->channels = ada4961_channels; indio_dev->num_channels = ARRAY_SIZE(ada4961_channels); break; -- 2.25.1