Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1708114pxa; Fri, 28 Aug 2020 23:50:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoQh/73ZHYJy6Ww45ncEoJFYZFR8DNzem/Rviezds4bTlvg0IM/vc7+F8JmRB0OKfO2i4A X-Received: by 2002:a05:6402:35c:: with SMTP id r28mr2211476edw.117.1598683800237; Fri, 28 Aug 2020 23:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598683800; cv=none; d=google.com; s=arc-20160816; b=KuS0PJXWhUPqP1phtIfofr7UqDpDeUM0W4pADKfJLZYC+gWnoDyg4FhopIJu1w0aTV fRnlxBY3f5+NU9PFAm6kbnvK1F6bJdIDrqVSRtMABaK80dTUVeLXJqmyk4g2IsUDBLDr 8PutnVB1fMHKx1eUS9Vh+gIF7QxXzq57TIJQp2Isztyc/ZKbat3aWoxdWb+PBWdZn7O/ NHU5PijVcBjkfpYQHB8sOHVs/ZGjBqnBRcYgCrHthK3dMCHZs1/V9b5OdKTDPG9Vp+OQ UaatcG4WnNNwj96HzpMfvrgfIdj9xGrFWtM7kZyRNj5osNvYdF01L2mO5NP1oJ3PEL1W dHIw== 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:cc:to:from:dkim-signature; bh=qLdpvg2GA9HbTWcrT/OO63pliAa3cBEKsEi0cjBp+Wo=; b=fcAd1DRKdsZlt/qVPO9Bys71z+8XsxncM/xDZ8fe2vdnzkfxiyIMJYVawa2g+JDNeI irpHLXwtnUdeMTvynraeTNLIkDnyXqP8763RF0w+BfTuijFoBQvuQxpRX78lXrDFiNtA 0+I4ncN41iiAVQ3DjLrgqvm5gN7gryXT3ssoaNRNYyLP6lRNVXuTCE+VeSjLnoiE9+ah DRw4h8Kaaf3Snaw967//qsNwJ4nky2Y+IdmAw5YhS7pYLPSwuM5YOf3Lj4u3AaLECbnB ag1+nE/UjqcROgjYT3lClwzCHRm/3ozyZN2Zy4iVcZD9Yo2pJC4e8jKOiZ6x1T9bhNY7 BhoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H0flPPFN; 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 s11si984635edu.88.2020.08.28.23.49.38; Fri, 28 Aug 2020 23:50:00 -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=H0flPPFN; 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 S1727815AbgH2Gsp (ORCPT + 99 others); Sat, 29 Aug 2020 02:48:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:41850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727784AbgH2Gso (ORCPT ); Sat, 29 Aug 2020 02:48:44 -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 EC00321548; Sat, 29 Aug 2020 06:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598683724; bh=SNQEDWZSEyuEV44lUPa7TZAgyAUN1wW018JYD+wKFHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0flPPFNaEIomrsd1SRrqn4dBuFpTvrWIKJVqoyaufENRJH25akJyOI3O8AxE1eMG dPx37vRWagc1jIxtsAoiOHiwK2Mn9EFDLWkkmr8MGdaCIpSa2NJsQ8ElCTxyKZ0ye/ WDVFpiTqyJ/11Y914cvy/Q78MEuHLKNQorJPCVPE= From: Krzysztof Kozlowski To: Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Michael Hennerich , Marek Vasut , Tomasz Duszynski , 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 Cc: Andy Shevchenko , Krzysztof Kozlowski Subject: [PATCH v3 12/18] iio: dac: dpot-dac: Simplify with dev_err_probe() Date: Sat, 29 Aug 2020 08:47:20 +0200 Message-Id: <20200829064726.26268-12-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200829064726.26268-1-krzk@kernel.org> References: <20200829064726.26268-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 Reviewed-by: Andy Shevchenko --- 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