Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp182517pxa; Wed, 26 Aug 2020 07:57:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsqmWZebGTnQ8Kp+pmRKFS436GDndQsIXaCv58gbxRUj0qQ1fcgClRH5YGqphlGOlqFZYq X-Received: by 2002:a50:ee07:: with SMTP id g7mr5919993eds.184.1598453853490; Wed, 26 Aug 2020 07:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598453853; cv=none; d=google.com; s=arc-20160816; b=BNIWmAnqQgL3RyzlWRJX+c5mY1f2UFrRF15cmoDf57MtdDdARagDjIMB7RRLYXf+bI WplyLVksf1qr/6hAXEBLrj3OKSCWV9s+7luL686paOg02GUwfcKODdqScsKMsEjJR9nV lOsNtkPB4gtXmotpwxRH82TOEerGlp59hZXW3r4u/WUZFTBLVXD9+UbxCOcQx0c2SMrv s9+Tbue3FwDwTWbB0Z0SijsHyyUg4beTNoE1JftdxnGVz6aU2L+LlzvaW3QMMZ53/E6u MzG8ikKrlkxZyTYNXb8k/DM7yd432/rTROAlyNFBiboYcbg4akFXzs7CdHT92RxFy/Hy ZvxA== 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=JgnvdrrPgtDWYPZgqgrHTlzlLldhqYi9WfFKKiRXLzI=; b=w87sjSigKRgoEKMhsj0vNyk3oOhR+Lo5I7jzVRBW7ZasGr1AXtUosfvcYMdzPFMJVW 7AoMAYmxTDiJEvNA5iQgXcAwzEZCVVMgUqDCbPi8qh/I+rBkT+Q5i25IUNszlL5Q1Dp4 ASz2XS9Lf/A0Y8g7Dr4xdTaK88ZEeIcDVd+bFg2mY3SdGhyl/DePUbAbY/ltxitO6XVY jGCjzesyX8G7iARWOxzTI35W31gqdlQyH1uKC9U0UNIEMXNS5rd6XBhjH4Gv8vq/AOCK UeExFHnmtoeehXqYrSP07vXyGBjUaARDpKaBuNZksJweytx5sAfTnbE2Uxx9yHnnw/rv S6AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cPny5w0b; 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 b6si1723643eja.208.2020.08.26.07.57.10; Wed, 26 Aug 2020 07:57:33 -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=cPny5w0b; 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 S1728258AbgHZOxb (ORCPT + 99 others); Wed, 26 Aug 2020 10:53:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:39942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbgHZOxE (ORCPT ); Wed, 26 Aug 2020 10:53:04 -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 B9CD2221E2; Wed, 26 Aug 2020 14:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453583; bh=OTM2oBQoZiAlV+XAfIAKT7r/gquf8Xx7bYhHoSUNzOQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cPny5w0b1gWvr3veWEmXDwmzRaVz/k83PcuL7utLmHw6zWfvrjQ1r6J/30m+cS/GT l8d8fx/q4VeNxkCTanQP2tmfPr3jbjSoj4hZNCmUnTX8UfXBB6p6FCgjtLO6rbQ0yE KjkIP9LM/fH97f44ri+rZextJ4xkzG56osJMHMac= 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 11/16] iio: chemical: scd30: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:51:48 +0200 Message-Id: <20200826145153.10444-11-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/chemical/scd30_core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c index eac76972f83e..92358797796d 100644 --- a/drivers/iio/chemical/scd30_core.c +++ b/drivers/iio/chemical/scd30_core.c @@ -705,13 +705,9 @@ int scd30_probe(struct device *dev, int irq, const char *name, void *priv, indio_dev->available_scan_masks = scd30_scan_masks; state->vdd = devm_regulator_get(dev, "vdd"); - if (IS_ERR(state->vdd)) { - if (PTR_ERR(state->vdd) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(dev, "failed to get regulator\n"); - return PTR_ERR(state->vdd); - } + if (IS_ERR(state->vdd)) + return dev_err_probe(dev, PTR_ERR(state->vdd), + "failed to get regulator\n"); ret = regulator_enable(state->vdd); if (ret) -- 2.17.1