Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp185527pxa; Wed, 26 Aug 2020 08:01:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj5W39yBDhCzklsYGG3XzGd0JXrLgV+J79RONtzdMKX7fD+6/wxhLj77+EAMsXYO0/SF+U X-Received: by 2002:aa7:d688:: with SMTP id d8mr15717813edr.168.1598454107452; Wed, 26 Aug 2020 08:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598454107; cv=none; d=google.com; s=arc-20160816; b=TYixhb3h78IxtQXk+z3kAqbiqAG6ffA9ri/PC0WOGGsEejYVi4MM+vtNYFsb9KvRTf VX3bFCWJT3eYg7bPLe6VUzndMp5VAEOYM4J4pwZ+osTz94UabfZ4mhvk9LMvctgMTNNQ KDqF+Rct0/gAitbUZsKR4o71l1O5RCfSJlFsUI8/tbqohBh2GoVkBLmI1hXBbozjCy42 fE551JmlBI2ShCopZYRdp02uwROnGIpYEsqY+pcp/OU0VbiHb/BWAfZVaTAyZtb8uYR8 SEvLx5ygvcCR0gYbLVT7D0d6hMYPV6wtWENwq801Gb74moFoOL37uI2+7JpaBbptFZQm QMXg== 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=QOidazeULNrf0enHhHIdaG9zkKlJkZm0d0sXULaF2kFb4zvHLR7XRkBBBucv56RQnB /Gjc/ds/uj53Z4JQzJpowQ5Us6tzMqImGz7bwW2aQ4D1AIABxnDV73OBHu3MGid2z7co BW+X1EUIALcQedfXhJ//eVn01W4UBZMU1DGydWDFfJ48gtjzhA4cHlLQG+R7f1qyoP+K 7KsT7pAcibuADbHW84Mh98To/WT6dVlFpHGt49yU9u1RCdDiL4mqEvYcw/9M+UMXa1FH XQ2h00oZFUYQcVlen9RYlV4HQzGMzojawhQqJ4FeST4t7W6EzCSToW6f0KZiXL3BoRda A5zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TcqQ7VNM; 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 gh10si598144ejb.75.2020.08.26.08.01.23; Wed, 26 Aug 2020 08:01:47 -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=TcqQ7VNM; 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 S1727833AbgHZO5j (ORCPT + 99 others); Wed, 26 Aug 2020 10:57:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728185AbgHZOxJ (ORCPT ); Wed, 26 Aug 2020 10:53:09 -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 274E822B47; Wed, 26 Aug 2020 14:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453589; bh=T5xvC4E4MsMwGEUX1i7xJJFIfrS9fUuZLYOkjgS9wJs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TcqQ7VNMtsK+sKv7CWZAgceEyGN4b2Kv4KecHfDzf2y6sQudrL/XO+CMTh0E0YAHT nl4Y8124+m8Egy0EyY4N9B+q4hWpeo7q4e+KRsmcpuEW0ZA3wnnH+0gc4ebw5vvi+b kj8Mh0mQoca0QAp+eL6ifjaReTfgXrfyoF5MrhPE= 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 , Jonathan Bakker , Alexandru Ardelean , 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 12/16] iio: dac: dpot-dac: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:51:49 +0200 Message-Id: <20200826145153.10444-12-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826145153.10444-1-krzk@kernel.org> References: <20200826145153.10444-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