Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4482910pxb; Mon, 27 Sep 2021 18:58:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynpajx7qePpLItJrQt9v9qG6lmGM6HgPSeQpaDpCfaV3gyX7rZxjxK9y9RtGymzFdWfHnd X-Received: by 2002:a63:4c5c:: with SMTP id m28mr2302315pgl.67.1632794312154; Mon, 27 Sep 2021 18:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632794312; cv=none; d=google.com; s=arc-20160816; b=zh+xyA1/1JRw3ccEcyauqhUCLn5HDIbYLH/gzVOXQSqJrF10iJ87nMQQ14IWQCDpRp p/a1GhBKDqdd8fVlCTZ32zJ/xMfsjuJzz8UpRT/kwYZ/MACcCO6NTC32tBaZGx6NypM1 oeCa9tJCTBuNDXQ+oMd5RDUU9C2jR2Uoe4yCVrNyZ4Nk7Q9e6uBa5e1BZw/ObQXJgtT7 mMWE6jrgQyAm/gvjxvo4JcKG5MyZyRhS8ax25X51R+jUSOZiuqqv/83vHCZOTIMzHMhz cNMUBHjWxG6MVuVQiaKxnW7BD9RRublbYMoSBhBptWD97N70KpvKpfocBZ72pydG7KtN lYbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=DwHVg8fXF1jqIdZrMQn1FybFziWqCLtUnb0PdO/Iml0=; b=Q0MVQkziCxzuzg3wVD+DgVK3M5Gios+Ypb62L6rwtDzVQlLM7LAiaCtm1/6Ok7SMgN WGkZY97F2YnECd4Wgs3+tq1sjFBUbRUXTedBw2ml0NPwaGhhgnAKk5OgE7vajMcbQUmE MC+hjHLa5xBG2CaWDazrv/ni5RH0FzqeEMNoEqvly+K7XCffGebmuESCJuvOGJPK5DPe 19UfWJMo/iETuc7OPdKPYNWRjDDYIadY2g4TrfM9KKu3e4HlolyhqNWUpa1KDFcugEZ6 +Qqr8u0BJkMBBFSE1XdJt56M3z6aalDQ1RAf1XwX+8jaOnZkYfzhGG+PUpbWYtwT0Yuz b0Ng== 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 p17si896778plp.283.2021.09.27.18.58.19; Mon, 27 Sep 2021 18:58:32 -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 S238507AbhI1B7K (ORCPT + 99 others); Mon, 27 Sep 2021 21:59:10 -0400 Received: from mx24.baidu.com ([111.206.215.185]:36228 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238453AbhI1B7J (ORCPT ); Mon, 27 Sep 2021 21:59:09 -0400 Received: from BC-Mail-Ex32.internal.baidu.com (unknown [172.31.51.26]) by Forcepoint Email with ESMTPS id DF474B54FA64E38ABC96; Tue, 28 Sep 2021 09:41:04 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex32.internal.baidu.com (172.31.51.26) 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:04 +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:04 +0800 From: Cai Huoqing To: CC: Jonathan Cameron , Lars-Peter Clausen , , Subject: [PATCH v2 1/2] iio: st_sensors: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:40:53 +0800 Message-ID: <20210928014055.1431-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 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 --- v1->v2: Remove the separate line of PTR_ERR(). .../iio/common/st_sensors/st_sensors_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index a5a140de9a23..732d0f8f99f6 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -228,10 +228,10 @@ int st_sensors_power_enable(struct iio_dev *indio_dev) /* Regulators not mandatory, but if requested we should enable them. */ pdata->vdd = devm_regulator_get(parent, "vdd"); - if (IS_ERR(pdata->vdd)) { - dev_err(&indio_dev->dev, "unable to get Vdd supply\n"); - return PTR_ERR(pdata->vdd); - } + if (IS_ERR(pdata->vdd)) + return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd), + "unable to get Vdd supply\n"); + err = regulator_enable(pdata->vdd); if (err != 0) { dev_warn(&indio_dev->dev, @@ -243,10 +245,10 @@ int st_sensors_power_enable(struct iio_dev *indio_dev) return err; pdata->vdd_io = devm_regulator_get(parent, "vddio"); - if (IS_ERR(pdata->vdd_io)) { - dev_err(&indio_dev->dev, "unable to get Vdd_IO supply\n"); - return PTR_ERR(pdata->vdd_io); - } + if (IS_ERR(pdata->vdd_io)) + return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd_io), + "unable to get Vdd_IO supply\n"); + err = regulator_enable(pdata->vdd_io); if (err != 0) { dev_warn(&indio_dev->dev, -- 2.25.1