Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp180609pxa; Wed, 26 Aug 2020 07:54:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGkwy8dQyP03iQ493X20wktBH+pwwd/JCrHQcziQYl+5iqAKPiJGmRiMnJRAkLtfpEq0y4 X-Received: by 2002:a17:906:5f8f:: with SMTP id a15mr16994549eju.291.1598453678235; Wed, 26 Aug 2020 07:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598453678; cv=none; d=google.com; s=arc-20160816; b=R2gefLrnVZt03TdHYWGbc3jYapQFHwnH+pP2+OyVgLLgLtziHx/iuBpdOU+sTkiTWT e+H1maaeabcXL0sgR1z2RD7lYQVW57BYus5gm+qJM/y9LsmtxVuKmz4ypaEpW6BCMvI9 bCsdt6DgHwTIFGKCxGKyKbyuVVNlaJNMgOOwU5ET/7iG3R07e0sUfKFCga1QwUqbQSN/ O6yJF3U6taKUcjSwAYTOeFE8vRohGdq3kKvXDd7pHcMiPzVyYg5aJH82EGU0BjE8pzfa bqp+G1PKY0iEP/3pCPiIXpK8kGt+AwSUT+YG6suJwOdDmbrBk56f1sEVe0xl98IhKgED 1fSQ== 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=f065FZFvu10OY23RrL8hMs9mCaf0khOI7SUv5lzuD2cgvci1PLujajgI8Bi99D2XkB oKHYxZYXWSiWX5uzOkmcKEShJ8yD3e9iJKpgSkV+L4BUnql+na95PdJswKfvul1wvfSn ge7a0P0/QhwZ4nYD8ntVsA7lexIA5/hyqXdAE0e83IWw+TSR/+kGROF+cgNT1AMRZwew Mlf10xR+R/9g4N6EANtQNjk7R0mezgPG8CBZT0S9crM+Y/VJd0YljnnZRg/EZxUYr18F BjEx9mx9GDIgdvIgogXJnuBFib8Zw0iX6czauPbdAsAGCIUNmBxfGy7hN4Vq+QtSr6FF uBHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aJrqJa6H; 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 64si1563635edm.423.2020.08.26.07.54.15; Wed, 26 Aug 2020 07:54:38 -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=aJrqJa6H; 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 S1728114AbgHZOwg (ORCPT + 99 others); Wed, 26 Aug 2020 10:52:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:38352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbgHZOwO (ORCPT ); Wed, 26 Aug 2020 10:52:14 -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 C0EAE22B3F; Wed, 26 Aug 2020 14:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453533; bh=9WnEmDPaImvJaOTWnFx8b/OSZEA9nx5y8bHKHDlhKUI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aJrqJa6HvWi+UDeHiktjcnwsc8pvpxK3yOD/bTOpc0gZ0Dz5jNA/JXWkV9VjM1hSi EZG3uyLXtjiAu642kY2Xla9sVjz6itQu/EscsjJ+s45ehCjWuRtu4Ye+wq19dH8gsP mAoIMP6wd/aAK7HX8R5JQR+boq/TIuNLctb4AbFY= 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 02/16] iio: accel: mma8452: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:51:39 +0200 Message-Id: <20200826145153.10444-2-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/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