Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp180520pxa; Wed, 26 Aug 2020 07:54:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwNKXpS61cgSm+dNpKKZLHQkIhz26WsH9w3JHDiDkOvpfg+FuO4+iFwtfwV9ow3LiYjLGj X-Received: by 2002:a17:906:b850:: with SMTP id ga16mr7722123ejb.101.1598453667810; Wed, 26 Aug 2020 07:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598453667; cv=none; d=google.com; s=arc-20160816; b=tSwrhWx43FlCGYylqIcg+Pp13nVG4Uutx6IOtFFds0VD8GgC0aIUMNwtXz0QNkUEjT GFh0DO7PbcX7wI93+7vxR/MWKvq3J9WYfuowFrddO6YDYv/NltPc8azZqAaXYOozSkpc rTTCjmIn/46o6PUuFYWiQKJYEXivypzyLu+BwCtcf4wm9iW7zB6HpxnJ7u22CT04VriJ edccpEgC5y0m/zs6xrXOz3UNvjVr2UwkIm8BkSyZhUdzIpG32wq6jMJunWeO1enAC2nN Q8VYYrv2oyG1M3TJ/Tv5hiJIbM38D5+I6ZHzKodsfrrGufDqRaaBo2S8yff3wbjNnNXK 3swQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=wfPnhtRjNWJq0UXRxj1bc0ZJHZbDd/0QmVyfTj4RZ6U=; b=ynil4iO8dj+2qDz0O6YXnCGA4C37aRtjr4BALb9KCCsXVLCxtWwTk8vFPbC05PiU1/ 2ET90IhT/r13da236vVcCTGh82Zy/pGZhrEqmYF0GS2NFk5fJkQZNMA0yE+kP2Lgn9uk rBIpufPPRCMIgTjMjik3rk34VxGeHvdM4ZJi48chovAuNgFecJmxZdRzcILNL2hfVya7 fbGN7XRofCGDoajv7NC/uiBXlcIRZTpr7Rz1PM/n60d0FydUar2YtkHFKoThMvyHZBaU RyP5ZjLKac22GtAkO6IunRaisVtUmldoxc2fcbG2w8rp/XI/xnT0z8zoorygRvu6dVZi 3+GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W5poQ48U; 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 h27si1758437ejd.317.2020.08.26.07.54.04; Wed, 26 Aug 2020 07:54:27 -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=W5poQ48U; 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 S1728107AbgHZOwX (ORCPT + 99 others); Wed, 26 Aug 2020 10:52:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:38214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727821AbgHZOwI (ORCPT ); Wed, 26 Aug 2020 10:52:08 -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 6CE2B21741; Wed, 26 Aug 2020 14:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453528; bh=lwcapEqh1mnH2bnwZTOp+jWQ1z3sGCNA5lWoA1rbyV4=; h=From:To:Subject:Date:From; b=W5poQ48UfnSWvBecbti9ouY3yxhCPYG7lJ2YWTWVuAvPzu89EU7+uxyv8YXTofPQB 3gXzjtXyB8/4Ngg7w+SKJToYcj5ZxCKpk+/tsTswwQXNhHScaZm2HPq2MnZV/thjFq k/Zgr1eJS8cgJ8XzHei6NU7DBymAvV//O1xoQWec= 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 01/16] iio: accel: bma180: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:51:38 +0200 Message-Id: <20200826145153.10444-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 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/bma180.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 5b7a467c7b27..448faed001fd 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -1000,19 +1000,15 @@ static int bma180_probe(struct i2c_client *client, return ret; data->vdd_supply = devm_regulator_get(dev, "vdd"); - if (IS_ERR(data->vdd_supply)) { - if (PTR_ERR(data->vdd_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vdd regulator %d\n", - (int)PTR_ERR(data->vdd_supply)); - return PTR_ERR(data->vdd_supply); - } + if (IS_ERR(data->vdd_supply)) + return dev_err_probe(dev, PTR_ERR(data->vdd_supply), + "Failed to get vdd regulator\n"); + data->vddio_supply = devm_regulator_get(dev, "vddio"); - if (IS_ERR(data->vddio_supply)) { - if (PTR_ERR(data->vddio_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vddio regulator %d\n", - (int)PTR_ERR(data->vddio_supply)); - return PTR_ERR(data->vddio_supply); - } + if (IS_ERR(data->vddio_supply)) + return dev_err_probe(dev, PTR_ERR(data->vddio_supply), + "Failed to get vddio regulator\n"); + /* Typical voltage 2.4V these are min and max */ ret = regulator_set_voltage(data->vdd_supply, 1620000, 3600000); if (ret) -- 2.17.1