Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp670721pxa; Thu, 27 Aug 2020 12:30:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9QOZ4UwHza9pT8qo4cxckY7tV1QmlB5R/QSXfuK4GZAhql8JbWLo+1dFZEp4QfnNY1qEn X-Received: by 2002:a17:906:3647:: with SMTP id r7mr18898319ejb.336.1598556628806; Thu, 27 Aug 2020 12:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598556628; cv=none; d=google.com; s=arc-20160816; b=x8O+dnLJcZNcBNgzvE3bbDNbee0dLFBhKpNu4KxzLayfv4goKOEDc/5D8sEpvK+8jS arib4iYncPPPrjLpFeWl1pcQ678ZDgj0K2ptkA65iJ+TD12WK8WOSKHCVGliNCx8QEeJ vm2zYmJYT/CDh+mf50jGCTAVK3Zr0qitDVZfxkssza14Qwo34ky3dzgjLyVR2S/nk6tP kLDa8djsMoUOtNkGvYseSRjuoLoj8p4vX21VzQj88+Luk9UfYZQYpvqTi7rSbrNovGF7 6QS7jHQt55oH7ObnnPGZsalDb8y474tI8GgXB/4cMVcjuKBwv6fgfy2LdGyIYYrKGBOK uu6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=Xrligp3po61/qzHKvbwHEGpv74sM5kh101CAXBpzufA=; b=W08rVG3e0ptP3opVgYewFL7GQo6DoavsOY8hl25UkNeuxbUZ9C8r5hynxvwYo1XGtw bERNHaIoW57bQVdBTo8xPfqkkbmb16d1R+ay8ikhXw5jYATjdNbwyzVizRGjJUCEpJ7/ IBfGmm7luOjeGAh/n9oGqVkVB8NbXl+yriS5MCxuy9ZhAnNMVs6ZNDbPLVuESGPesEYd N2fhXSCDa8xHVqkti5Jy9hf+JYfZEKRdh+Pe/JTDx2hZeFp43s1WkpqGWu5J5pwSx+ux mLoAmNbWJj0NXAiQRiZvlQ+WrQ31cRpzz3k3XBpoYimlFugmjgrQsRcH3rmsEPHoTQec tfew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=em6vO2Ow; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yc29si1943506ejb.674.2020.08.27.12.30.06; Thu, 27 Aug 2020 12:30:28 -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=em6vO2Ow; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727907AbgH0T2o (ORCPT + 99 others); Thu, 27 Aug 2020 15:28:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:59974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0T2n (ORCPT ); Thu, 27 Aug 2020 15:28:43 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 12F0122B4D; Thu, 27 Aug 2020 19:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556523; bh=T5xvC4E4MsMwGEUX1i7xJJFIfrS9fUuZLYOkjgS9wJs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=em6vO2OwZSB6kKK/S2ezhIGI2mfeS6rsgTIRju9Qabve7CfOTbj7wTG8NQXHDrhoB LJi16xE4xrJLYdEiSC9v+RYNMd4jSluKkFZBGuNEkYZ1BN/UB7qokxNWc0Fd4y6XZ+ Tdy6RbrclSrZxz3+tGvj5p2iOfiCxYtAjmLOesFI= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 12/18] iio: dac: dpot-dac: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:36 +0200 Message-Id: <20200827192642.1725-12-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski --- drivers/iio/dac/dpot-dac.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/iio/dac/dpot-dac.c b/drivers/iio/dac/dpot-dac.c index be61c3b01e8b..2258535b8a42 100644 --- a/drivers/iio/dac/dpot-dac.c +++ b/drivers/iio/dac/dpot-dac.c @@ -183,18 +183,14 @@ static int dpot_dac_probe(struct platform_device *pdev) indio_dev->num_channels = 1; dac->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(dac->vref)) { - if (PTR_ERR(dac->vref) != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get vref regulator\n"); - return PTR_ERR(dac->vref); - } + if (IS_ERR(dac->vref)) + return dev_err_probe(&pdev->dev, PTR_ERR(dac->vref), + "failed to get vref regulator\n"); dac->dpot = devm_iio_channel_get(dev, "dpot"); - if (IS_ERR(dac->dpot)) { - if (PTR_ERR(dac->dpot) != -EPROBE_DEFER) - dev_err(dev, "failed to get dpot input channel\n"); - return PTR_ERR(dac->dpot); - } + if (IS_ERR(dac->dpot)) + return dev_err_probe(&pdev->dev, PTR_ERR(dac->dpot), + "failed to get dpot input channel\n"); ret = iio_get_channel_type(dac->dpot, &type); if (ret < 0) -- 2.17.1