Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4473978pxb; Mon, 27 Sep 2021 18:42:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2An9392A6nX+ysj4E6yzTrZUbswmeg1+OGUZhOp5hLG8yQR+FDidydTarlJKD7OwJkcGp X-Received: by 2002:a17:902:dcca:b0:13e:4139:8f0f with SMTP id t10-20020a170902dcca00b0013e41398f0fmr2642709pll.65.1632793336538; Mon, 27 Sep 2021 18:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793336; cv=none; d=google.com; s=arc-20160816; b=j+Xe8GOeqEy1hyPAlsMi3g1BeMgAAaDFe5mTbLmyN0F7D/8eeP5Y4KcmjBpnBLigU3 X08xBj1CoG7u5SXq3wLVd2S2L/4bva0EIZSGdWaVIXO2hRB+J+CHwA8tt7cZgPy/Gbw1 j5y60LWORmaqXIJhRnZnOhyAsxm5MHgkwsP801nrNW16hh65Uq4dilUrkjGt6Zrg9+Lf oPvOZJt2ABxWD841iLI5R6jErRjsX/BvYx7I2gCqEpSLPbVrhPbWetHSOuteCiuliu4M tsQm9j8fWtFoDUHUtH1IODU+rNqZtnKj+KYS/wpepiQ+vyJYZz5NFvBmD3pPSEBX0/+M WZ2w== 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=vk0Yz9xkT1m57UDKDDK/cCxEMKMg0LSORwLcAnLMqDXIrTP6YBIZqCdU4N/90SGVfk D0G+Ml+FuxeTh0pTD6BMvN+Lks5RvRDd1Cgs7usj52rH7vW3Jr6/GbkMtOACz8LYiUZP VZYT9/k5PpSQ85UsFUB/uK0zbaWr7ughDARghA32FpT+DUYA5MSs5uRKF5BaZ4/MN1GJ KEDZaIhmytkoZFU1ZDIf4tlKR9xw2CWOZTtgEiN50BvpktqOQ84v87C6of+60yfc6yu7 Xq3NetkATCyOyutb3/9dtim1Xdmq8KDmaMn7EYMk8DD8lgEK1CxLktz9aj7czETyAgqk q0kQ== 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 25si11005465pgy.483.2021.09.27.18.42.04; Mon, 27 Sep 2021 18:42:16 -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 S238479AbhI1Bmv (ORCPT + 99 others); Mon, 27 Sep 2021 21:42:51 -0400 Received: from mx24.baidu.com ([111.206.215.185]:49524 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238437AbhI1Bms (ORCPT ); Mon, 27 Sep 2021 21:42:48 -0400 Received: from BC-Mail-Ex31.internal.baidu.com (unknown [172.31.51.25]) by Forcepoint Email with ESMTPS id 78A349228FC2B4B57F4C; Tue, 28 Sep 2021 09:41:08 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex31.internal.baidu.com (172.31.51.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 28 Sep 2021 09:41:07 +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; Tue, 28 Sep 2021 09:41:07 +0800 From: Cai Huoqing To: CC: Jonathan Cameron , Lars-Peter Clausen , , Subject: [PATCH v2 2/2] iio: st_lsm9ds0: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:40:54 +0800 Message-ID: <20210928014055.1431-2-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210928014055.1431-1-caihuoqing@baidu.com> References: <20210928014055.1431-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex24.internal.baidu.com (172.31.51.18) 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