Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp670709pxa; Thu, 27 Aug 2020 12:30:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/PBJ6bNnsir5IGVKcPObdjskOdBHZMo7pvS1gwUOJEzvQomHFbxLuEhm+1pjoC9YTFTjv X-Received: by 2002:a17:906:1106:: with SMTP id h6mr22525318eja.200.1598556627555; Thu, 27 Aug 2020 12:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598556627; cv=none; d=google.com; s=arc-20160816; b=l6ebaeqseVUEUQU48bdDAECGaAys9cBcxkN7/eovOT1Y5/3HeCheSeUuy4ZqWI7CS4 Vvn7PtU1K5HHS7kRl/ZpnDagTh03jwaaI2J51ThxbhrpyxNJHnhRl2T5EfbF0onhU4ls aP78mKohsv8P4uTD9V7K70Pch+9hJPoprYDib1lsKUunlfdfkFnSJjCibUUHhMYfZ9el Fneg4U95zpTk43y+Hh15hFcTOrQcaz7pvzFcPTxR4UiRWyi0xkLDBx5rMTIMmGSgBHeE P0rOQRT0FWAPmN5Ue9DCCuG0H9LL/nDQrcgV0cdIQfU99qaaxAFxmrOV8YY6KXQCSZKW 4U7Q== 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=xmdpDx7t8Tk+uQHpnaQzXv9YmtXKv0/p5ZzJLg7PmuI=; b=Us0rGQNWwv0QBX8Q8Z49BB95S4pAJF/n3GrnbX281/gobFAwzSdroxyCuoa2aOaxgQ zTsG2R8BBEoPclqh4Kb56Rhu9+kEByH7okSxSH9K2jqemjA3g+OyPMHY9xq7And9JqW9 Pd3c6PWKkke1rIk1CdGj1KrzOYZ+RgjDnTmrVyqGdYzdrD0KFw7dSwcjdCfoMYy0iK6l 49FLrhpSfmO1d17f/qX+CwLZRClvTR1XWf3WZxKwZembI4DpQ0Hs1atUtfYfbj4BLmXI rrDDRMhvMfgv5Bb/ziiwcP5xJTe4QlRqOXAr0ACDzXo+Htt6ncYVCVHKUfIj/mlgNpt7 8yMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gsfd2cae; 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 t24si1976603edc.143.2020.08.27.12.30.03; Thu, 27 Aug 2020 12:30: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=Gsfd2cae; 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 S1727885AbgH0T2i (ORCPT + 99 others); Thu, 27 Aug 2020 15:28:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:59764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0T2h (ORCPT ); Thu, 27 Aug 2020 15:28: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 6FD6322CAF; Thu, 27 Aug 2020 19:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556516; bh=X1W0PzSz8JAQ2Wim9RQvp9YS6C8n7Io0DSsH6zFBFQc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Gsfd2caeBHKY0vWdsUPo4XNAU+ooS5fvtQ2z5WHLpESCCzoR689Z9u9buf1i5PARP AVNXERHSAWrKZDJ5YR67LdHEDzY74qCW772IKe3wcoZj2OB23Qps8pvMkH0xsoyui8 PmBIa4o9PfYpbUd/BL691P4eUcDuSfG88hTLJugY= 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 11/18] iio: chemical: scd30: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:35 +0200 Message-Id: <20200827192642.1725-11-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 Acked-by: Tomasz Duszynski --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character 2. Add Ack --- drivers/iio/chemical/scd30_core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c index eac76972f83e..4d0d798c7cd3 100644 --- a/drivers/iio/chemical/scd30_core.c +++ b/drivers/iio/chemical/scd30_core.c @@ -705,13 +705,8 @@ 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