Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3758675pxb; Mon, 27 Sep 2021 01:43:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLk0235jn1sSDhTBu+5QoRZ9LbfIjJL9J7sVGWzrT067xFw5GiZ/ly7nqsTJepMQR8kfjD X-Received: by 2002:a17:90a:86:: with SMTP id a6mr18025426pja.190.1632732190288; Mon, 27 Sep 2021 01:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632732190; cv=none; d=google.com; s=arc-20160816; b=Oh9+xTDkedD0pgC4tZxTw8p49Om0vpDnzWXTtSmN0AJlT+q6/QjBse497OEKdQsFKn BuKTvq2NMKit926EwFr3LkBEMvvh/u3tYWpWLuNVHy7RR0IFSn/mgFn3mWi6jZwHA3J0 uFFN5HyZsQHHcvzcXQy7boX/2esJNr1zaMtLlP0LI4vW8ZSHRlyZ9XuDPmPwh7wzhcVU pkAVuDHM86JiOLnInbabytLNsf9cB4HDmGYcbB/506fn0HzZmdDU/bneSgQGY3fc5vXH f81nwI419sVlx2KL9CK5nHjl07L0juHmZFmqNy5U8391sV5c35jQKU2tRsWHd9GkNLkX XzeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=zIJNZTnk4K2oQtLWT4iLCVXDgjut0TYJlGOyToCawO4=; b=gbWN+hIJdX5tTCMW4n/x7l7qoVAaT4J3iHR0ZfUWEbQoITL83ReZHlRJx5lrMOEAmY J+VK2GL4zXQ923VH0lQMClt2EcZz8EyGATnRiSkBCSP8YQhac6xb1ChLaUAA4Ky9o7uZ CDB1YfqRdM5VgEm2Kj2y8sfvAKl4YJnd2MaZqqNDapRz2AjwpUSEqDgQdkdOKeijYdoy Njm/FhHufrXV4PjL2UaEf3ockqwO2iU6HdGSn5XrfY4BcFLI8mcMmRLVFtdN4pfCq26b 3za8fFBy/UeUnodrQrXHDgxqHX/hOVSDQJ9lYH3XnZE5zP0Li3ZozLuz2sbr5ix8LaBC vqiA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y191si19218878pgd.556.2021.09.27.01.42.58; Mon, 27 Sep 2021 01:43:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233496AbhI0Ina (ORCPT + 99 others); Mon, 27 Sep 2021 04:43:30 -0400 Received: from mx24.baidu.com ([111.206.215.185]:50242 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233403AbhI0In1 (ORCPT ); Mon, 27 Sep 2021 04:43:27 -0400 Received: from BJHW-Mail-Ex03.internal.baidu.com (unknown [10.127.64.13]) by Forcepoint Email with ESMTPS id 4DDCEE043F4458672273; Mon, 27 Sep 2021 16:41:48 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex03.internal.baidu.com (10.127.64.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:41:48 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:41:47 +0800 From: Cai Huoqing To: CC: Jonathan Cameron , Lars-Peter Clausen , , Subject: [PATCH 2/2] iio: st_lsm9ds0: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:41:36 +0800 Message-ID: <20210927084137.1081-2-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927084137.1081-1-caihuoqing@baidu.com> References: <20210927084137.1081-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-EX08.internal.baidu.com (172.31.51.48) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c index b3a43a3b04ff..9fb06b7cde3c 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c @@ -24,10 +24,10 @@ static int st_lsm9ds0_power_enable(struct device *dev, struct st_lsm9ds0 *lsm9ds /* Regulators not mandatory, but if requested we should enable them. */ lsm9ds0->vdd = devm_regulator_get(dev, "vdd"); - if (IS_ERR(lsm9ds0->vdd)) { - dev_err(dev, "unable to get Vdd supply\n"); - return PTR_ERR(lsm9ds0->vdd); - } + if (IS_ERR(lsm9ds0->vdd)) + return dev_err_probe(dev, PTR_ERR(lsm9ds0->vdd), + "unable to get Vdd supply\n"); + ret = regulator_enable(lsm9ds0->vdd); if (ret) { dev_warn(dev, "Failed to enable specified Vdd supply\n"); @@ -36,9 +36,9 @@ static int st_lsm9ds0_power_enable(struct device *dev, struct st_lsm9ds0 *lsm9ds lsm9ds0->vdd_io = devm_regulator_get(dev, "vddio"); if (IS_ERR(lsm9ds0->vdd_io)) { - dev_err(dev, "unable to get Vdd_IO supply\n"); regulator_disable(lsm9ds0->vdd); - return PTR_ERR(lsm9ds0->vdd_io); + return dev_err_probe(dev, PTR_ERR(lsm9ds0->vdd_io), + "unable to get Vdd_IO supply\n"); } ret = regulator_enable(lsm9ds0->vdd_io); if (ret) { -- 2.25.1