Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp669672pxa; Thu, 27 Aug 2020 12:28:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwq9aoAPagw7+G+/Av+lccPABLYrjtaTbqECIXMj6pURYzhKLBLCK6A5ag99mJaG1UOCZJp X-Received: by 2002:a17:906:a182:: with SMTP id s2mr21956245ejy.526.1598556522269; Thu, 27 Aug 2020 12:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598556522; cv=none; d=google.com; s=arc-20160816; b=d2kNMsxu2MzJPuf53qvv1nPDUx/WGQNBVN72zweQFm4SX9sgI4KUi770SfqCUPOAM1 6k4gBi+T0yF8MtIEjeAF5J5hvuEkqv523fXVGHioynQ+bOt0oONpN8lt/56+LtlIhO5B Rp2qKg6w7b51EUCh+xoVlVUvf1EDOcxL4E04g5nAwbBN4KP+Phh9bGsQkmyuUmHQZjIr 6Pk08qfQUslmdIE8/tvWm0DDyN5OYywNq9p3cgXq6UXf981dLblqbZwH/Eyt8Y2HZFTh BT/SHH18RxRqjOlKNQvEjQ1mbU5EOvWn98BegfOU+Q+cUweyOTCj6py9i+WD2WbACy0c w67w== 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=fGf0urKpz3rsCihFPJIsCh+K1zQDRFYtk6TPr/XwHG4=; b=PwNYuCm8AaOz9lXuWmL88tDQ2CDY25nfNeTrcfQWw2sekyoMkyrR+8CoCA7MVcJ5V2 +icSr6Ug51OnkaUXkZ9/rLGOs5DoH11CDBJX45JXxdjULI41bVNYc0pa649bT4BSyZCU T4qf2lpNUbFFyh/iOHP1PmeLqhL3PcBBZqSGKf+LV3WlAYSBQ/DdTvvoIlRa3ublkiZ2 Z38h1/SUMYnqn2N0jBKwnR353sH8jim4WEzyGqSEnhpicNFeQY+AQXAS1G6eren5MAE4 /VAPzdMOP/pu6ENXSbS29fuO2EbjvtGZFaLQ18OlxW61yVhkZPo+/7AXBfXeM0SjZHjj FS7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S2Epfqrd; 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 m17si2121939edq.334.2020.08.27.12.28.19; Thu, 27 Aug 2020 12:28:42 -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=S2Epfqrd; 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 S1726804AbgH0T1i (ORCPT + 99 others); Thu, 27 Aug 2020 15:27:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:58468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0T1h (ORCPT ); Thu, 27 Aug 2020 15:27:37 -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 AF7D722BEA; Thu, 27 Aug 2020 19:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556457; bh=9WnEmDPaImvJaOTWnFx8b/OSZEA9nx5y8bHKHDlhKUI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=S2EpfqrdIG/s0KQe6KaMBJ3NNqM+aQAEaTU2AbvSNF6WKjWIi4iijElsA93Sr+xw3 hj7HOBgbVfqyWCVbaCODneeXlgxLmWbEjbgab2k3j4UwyaS70nE4jlCotJBY5uxLfy pbNIqxcf70lUqcRT2KNkTd4ootECTNn3li8CfU+U= 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 02/18] iio: accel: mma8452: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:26 +0200 Message-Id: <20200827192642.1725-2-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/accel/mma8452.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 4e6e70250048..104b87b98455 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -1538,22 +1538,14 @@ static int mma8452_probe(struct i2c_client *client, data->chip_info = match->data; data->vdd_reg = devm_regulator_get(&client->dev, "vdd"); - if (IS_ERR(data->vdd_reg)) { - if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(&client->dev, "failed to get VDD regulator!\n"); - return PTR_ERR(data->vdd_reg); - } + if (IS_ERR(data->vdd_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg), + "failed to get VDD regulator!\n"); data->vddio_reg = devm_regulator_get(&client->dev, "vddio"); - if (IS_ERR(data->vddio_reg)) { - if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(&client->dev, "failed to get VDDIO regulator!\n"); - return PTR_ERR(data->vddio_reg); - } + if (IS_ERR(data->vddio_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg), + "failed to get VDDIO regulator!\n"); ret = regulator_enable(data->vdd_reg); if (ret) { -- 2.17.1