Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3749353pxb; Mon, 27 Sep 2021 01:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB0ZAzueIbQkerDAxN1EpU538a3AfJla6sF/tM0srG9yMqJxwMsgBF9lYCt8WaIfxon4VI X-Received: by 2002:a05:6402:16cd:: with SMTP id r13mr1967400edx.213.1632731282173; Mon, 27 Sep 2021 01:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731282; cv=none; d=google.com; s=arc-20160816; b=f4HTTchAHSnsHA/yPcD8fl9yOpFJHWwqWVP6ye79hIc5oBQcSB/B1muLOPOrnuakMo hu6IEym/0LDxWJmUlC/ThXngCkX3MnY2K8Ip029mt53+KE6WU+nEomvcvLgOhV7tMNSL 7Ezx95il7Nsiw6qDBU9Rl9xj8I+cFJM4WLomQrd5R5/qpPsPJImwNdogaieGlWk4d2QZ mXUukon2mza2Ai4XH+nAIWGZaox2rYOHOypreHrqGedAfyEtWDphcUNePuDE1aGpQuLI o7VYMCkzFiaZwEeHLCxPMVGAu1sU1uEfGyrnzJsB6EAr+4eOd1SgHSLO2Zrziv5SOTiT MhEA== 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=WW/YrTV5h2pM7ekcPltEhDEM1MM36fyn4nY+hnp9kUplN2egk72tgRM7XZsFdMLL50 CycvVZdoPVSz30D5HVmJ2TRPweQCKLN100xV5WybVt+OLk8thNg1ygxVm+gL8UeJWQ1v q5KufUQptNW4ZsGZ5zOXNlGRCEZSkLXJ/SFML5LMZElBcuGFzudrWnbzQkpmOV6hnOnV vFxJcAt6zI19A3eHLq5wea3qgTj/qG8mW14ffs4OvwmWizZvxtGh/aJpT6K2Fu/7MX4n oH4BAMj10l4XZ8s0qm8yU+1gB+aKUAo6m1E67pdDF2L7R+6/g1DuM/j1bxhTaA8Jw3bM yeWA== 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 e9si14502651edz.119.2021.09.27.01.27.38; Mon, 27 Sep 2021 01:28:02 -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 S233416AbhI0I17 (ORCPT + 99 others); Mon, 27 Sep 2021 04:27:59 -0400 Received: from mx22.baidu.com ([220.181.50.185]:60562 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233337AbhI0I16 (ORCPT ); Mon, 27 Sep 2021 04:27:58 -0400 Received: from BC-Mail-Ex16.internal.baidu.com (unknown [172.31.51.56]) by Forcepoint Email with ESMTPS id 513225E8B226CE5ED1B8; Mon, 27 Sep 2021 16:26:19 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex16.internal.baidu.com (172.31.51.56) 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:26:18 +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:26:18 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 1/8] iio: dac: ad8801: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:00 +0800 Message-ID: <20210927082608.859-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-Ex15.internal.baidu.com (172.31.51.55) 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