Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1708066pxa; Fri, 28 Aug 2020 23:49:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZmwhOI1nK9vtxX8ygU1gCbNBW4F+aDGzlvCv7PW+apPVoqUeiqs6qoEg11xce7uw6iRrL X-Received: by 2002:aa7:d596:: with SMTP id r22mr2329261edq.204.1598683792198; Fri, 28 Aug 2020 23:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598683792; cv=none; d=google.com; s=arc-20160816; b=T5vIkoQDU2QaeXfCaC5IaQw/NKrFXW5pdz1/Lx9ygWwrsreKMIDrhBX5sBf1hVDBgX YfayhBQPBdwLc5vdZo4o5puHdkdWcee/bXISKggOJs8MBDtfIspSDbaVQrYYNa9ZN6RC L6s6iHlZMHngSNj57UX1YXdaKaV7G6G0ZxHPO2HRxSE7EHc++RKKVBJkX6vZnugAPmFt 8dmxh/d+TpD7jV5tQUzSa7RJ4yvPWIche0EH5TfQNKit2cLbTtOrsFj+3KoVE25PWIzA q3KFMQiIsu4Zymwlu5R13Rmz3azvs3TRgyPa+xnlO9vis6fLsQoyEjGEiq8zoXdUel1o SHLw== 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:cc:to:from:dkim-signature; bh=ujNebk3RYphpGGJ1LKqlKDWwuURW/cj3Bt2+5BZgn/g=; b=vSFkeC6CS/DvmM5ryi7Qv1a47MSWSyezdskGqTdsPMxjBbiB7FJ43SZkIDRcCHVB0O JX+DoQeCFyheAI1tp9n1wB4NqpFhc12gLlwsuDzAZvLZ7OE5jowagXKSmdo7IMn9sp+V DcbY1i2WBHRTsa0GyFzNCLUXUBSB4254WRy7QSZUEyGB97m2mWf153Le2B3yW6Hkw/v4 TIfhBbxM+ErqqefLXEj6CJNj+3PDTxhY39OHzS7gd0CKSiwD12oQIcSn5B/NTSlhfobJ JWAEWyhlTGjaaaVTVLEp82S1t2M30ERAMnuJH9ngBzMbqnckCHi5m1n8hUBEf5j0X9ra +aWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CYy1Zk1i; 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 a1si978309edn.356.2020.08.28.23.49.29; Fri, 28 Aug 2020 23:49:52 -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=CYy1Zk1i; 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 S1727783AbgH2Gsn (ORCPT + 99 others); Sat, 29 Aug 2020 02:48:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:41690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727116AbgH2Gsl (ORCPT ); Sat, 29 Aug 2020 02:48:41 -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 6DBCF214D8; Sat, 29 Aug 2020 06:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598683720; bh=ZelpFQ0282/QvKyDJRVrg0JcM6UJUGrhhAA87ejo8k8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CYy1Zk1iYCDKzFrBSi2C3ND3V1n6vGPXAg7QK3taHdYEchQmiQU+vbsGs1kVqphQE zEEEyvQBpdQB9NdoY20HEaHc6MvVk7FNVQcANMxwDHSJbMsZpDtwOgifakZJuv/Ctj 6ohXnR3ClgeEw0PjuYD3JQp/PlB5HF2AvPaXEUGg= From: Krzysztof Kozlowski To: Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Michael Hennerich , Marek Vasut , Tomasz Duszynski , 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 Cc: Andy Shevchenko , Krzysztof Kozlowski Subject: [PATCH v3 11/18] iio: chemical: scd30: Simplify with dev_err_probe() Date: Sat, 29 Aug 2020 08:47:19 +0200 Message-Id: <20200829064726.26268-11-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200829064726.26268-1-krzk@kernel.org> References: <20200829064726.26268-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 Reviewed-by: Andy Shevchenko --- 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