Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3758415pxb; Mon, 27 Sep 2021 01:42:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgCWA0SP6BgZhNw7c19wMB2Q8kwUjr4oIOmQS7e9MrFmM9dDGsugoxEvlRLV/wYeL99usY X-Received: by 2002:a63:8c50:: with SMTP id q16mr15390040pgn.15.1632732164293; Mon, 27 Sep 2021 01:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632732164; cv=none; d=google.com; s=arc-20160816; b=oBg7iaPdtOH+n0+tzbI/3XIlF3zPldSFhhyeWdrCv9Fmb9cLASTRjDru54WkZva44p tutIj5PsEqIIB87Wb6aIHzjZvYkvPY+N/ILRPgQ6YdaZ78Cf7htO+PTrnApduIj+fNbP sILkFKIPInuG2a+xTPXPsKB8T1L5kJec3u2aX1KzCPbTy1auEnq4vFZCmdt6Kc57Hz5S gcjLBD0i/Dbb1EsmtvSI9al4bLk7GZgyb+8BiSCuR/iMTs6erOWOXGLD69t2J50rbKsk qXZRN0DLHDpHpjtBKU4owBrvJCM0iGP+wYCNEN7WjIbkQIig1EufOzSN2iCwOC7fbRBc RGoQ== 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=Yd540bRhgK2iRfiRoIXwHXPFIO+Nk/+prP9mEtwEDhk=; b=jNEx/cB3FNmWaeKotbJaUXpRMSbW6CF+UghRQYHqYJWeR9opThre271A1lCGYFB4nQ DwTOL3jcZ8LUFvaE9YD/NRcGpieZFvs6AwQWlRu2PmXIVXqvRFrm0+o5qDjAuYQO0Dln janZTcrTtjUbYC7QkZjlBxB4Z5uGBTFyXJl8jEQc7+R4Jvxax+7dP/3fa8WDZjYKRJQW pFh/N4w7ebuprdUgR/XlBLEQ5tKOe2qpYi1HKDbrqfjTejT6+l6SeB7aE9D/IDrzXnuN KZc7HzH5lISxMefzQvLd/YUMKikwHD77GtOCw2ojrwhuqcYWcNdITwlod9qrDwLZcKWT n2Aw== 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 w18si21391548pjg.88.2021.09.27.01.42.32; Mon, 27 Sep 2021 01:42:44 -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 S233507AbhI0In2 (ORCPT + 99 others); Mon, 27 Sep 2021 04:43:28 -0400 Received: from mx24.baidu.com ([111.206.215.185]:50188 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233337AbhI0InZ (ORCPT ); Mon, 27 Sep 2021 04:43:25 -0400 Received: from BC-Mail-Ex17.internal.baidu.com (unknown [172.31.51.11]) by Forcepoint Email with ESMTPS id 2C40482073217AA26C03; Mon, 27 Sep 2021 16:41:46 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex17.internal.baidu.com (172.31.51.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:41:46 +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:45 +0800 From: Cai Huoqing To: CC: Jonathan Cameron , Lars-Peter Clausen , , Subject: [PATCH 1/2] iio: st_sensors: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:41:35 +0800 Message-ID: <20210927084137.1081-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-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 --- .../iio/common/st_sensors/st_sensors_core.c | 18 ++++++++++-------- 1 file changed, 10 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,11 @@ 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, @@ -244,10 +245,11 @@ 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