Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4472882pxb; Mon, 27 Sep 2021 18:40:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdvUMxIagHxC2rG/5ENbYdxZzxh8mWzkkJIrRp4oKNKczeov4PhYaHn+CVowRpMAjPcHUH X-Received: by 2002:aa7:9f8a:0:b0:43c:39be:23fb with SMTP id z10-20020aa79f8a000000b0043c39be23fbmr2876996pfr.57.1632793221681; Mon, 27 Sep 2021 18:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793221; cv=none; d=google.com; s=arc-20160816; b=Yro3O9algniAbvdwpXaO2op/N1R8yAe+Mmvt/qDdn+eBeQumuIUnTnlLU2d2JNCISA Qd3g7n+r2ZJjoqyeYcgA6dIqSlwJSvqmpJn/GrcVA65NmVJoLdrgHQmQlJdqcyqI9MaS O6AVhzQWh6t86+3LQqyYy9xsFlErfm0QG1kJEvpEPHBNonQLAr+7bm2ajIyP2P0it4fP /9RKWwHxaBKIkeKVTDhvyWiq7/mnl8rm72wwwG4eJ9ZIhGofiKpfT7nfz0bQMnCdV6V1 IX3yT/hGMtxE7JtkK8mcluK8Jz/T3ebv/yiJ5dCIkb1ENG6MUmn/OA1eWTR074eKPLaZ vglw== 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=rnPV3IoiJxAlCuKoMzZprBevxTAwF/StcZZ0UDziTng=; b=GXGucZQN3M8c12kszR2+NDPWzP/KgYmlwBcYXCUnLW5pvIVjY2sw92eQQA23pcIvDs 84GZWWBQvIg4t0m6yvjG3o0wZADKaJbWyo+10/3Zj7mOctcg0jOH5XQCJ5JZowJG/2V1 xNxbCdXdOVOLcRU65l47+aVOQ2C6c5zGLN0BRJBf4uBETbJ6Tk1Z901rZZF/azj+7XA0 XFeenY7shd3nMdcszQ39mfgoNd+14G8QFMsZq4n2xrW2UKn+30tBLhh23LAnuo5kUr76 fndugtpWYHT8PJv7fD9TjIkkV7ZLbwNy57Y/oPRmng3VxHfsnvFuzhw/baCuuRJUBSW9 79cw== 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 x1si27722548pgj.59.2021.09.27.18.40.09; Mon, 27 Sep 2021 18:40:21 -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 S238466AbhI1Bk4 (ORCPT + 99 others); Mon, 27 Sep 2021 21:40:56 -0400 Received: from mx22.baidu.com ([220.181.50.185]:47548 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238482AbhI1Bkw (ORCPT ); Mon, 27 Sep 2021 21:40:52 -0400 Received: from BC-Mail-Ex12.internal.baidu.com (unknown [172.31.51.52]) by Forcepoint Email with ESMTPS id 813C56A36F884F3B81FE; Tue, 28 Sep 2021 09:39:12 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex12.internal.baidu.com (172.31.51.52) 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:39:12 +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:39:11 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH v2 1/8] iio: dac: ad8801: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:38:54 +0800 Message-ID: <20210928013902.1341-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 --- drivers/iio/dac/ad8801.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/iio/dac/ad8801.c b/drivers/iio/dac/ad8801.c index 6354b7c8f052..8acb9fee273c 100644 --- a/drivers/iio/dac/ad8801.c +++ b/drivers/iio/dac/ad8801.c @@ -123,10 +123,9 @@ static int ad8801_probe(struct spi_device *spi) id = spi_get_device_id(spi); state->vrefh_reg = devm_regulator_get(&spi->dev, "vrefh"); - if (IS_ERR(state->vrefh_reg)) { - dev_err(&spi->dev, "Vrefh regulator not specified\n"); - return PTR_ERR(state->vrefh_reg); - } + if (IS_ERR(state->vrefh_reg)) + return dev_err_probe(&spi->dev, PTR_ERR(state->vrefh_reg), + "Vrefh regulator not specified\n"); ret = regulator_enable(state->vrefh_reg); if (ret) { @@ -146,15 +145,15 @@ static int ad8801_probe(struct spi_device *spi) if (id->driver_data == ID_AD8803) { state->vrefl_reg = devm_regulator_get(&spi->dev, "vrefl"); if (IS_ERR(state->vrefl_reg)) { - dev_err(&spi->dev, "Vrefl regulator not specified\n"); - ret = PTR_ERR(state->vrefl_reg); + ret = dev_err_probe(&spi->dev, PTR_ERR(state->vrefl_reg), + "Vrefl regulator not specified\n"); goto error_disable_vrefh_reg; } ret = regulator_enable(state->vrefl_reg); if (ret) { - dev_err(&spi->dev, "Failed to enable vrefl regulator: %d\n", - ret); + dev_err(&spi->dev, + "Failed to enable vrefl regulator: %d\n", ret); goto error_disable_vrefh_reg; } -- 2.25.1