Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2178105pxb; Fri, 8 Oct 2021 02:31:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+Q2JLdQEgPzseHH4URN6BsyxnpCQ/JYJVKy5E6svhvcUL4FadzwfOlarGp0YoQIA3YRjS X-Received: by 2002:a17:90a:aa93:: with SMTP id l19mr11200000pjq.241.1633685469683; Fri, 08 Oct 2021 02:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685469; cv=none; d=google.com; s=arc-20160816; b=ReumHAlKJL11xNC6nGs+RAFAtyHomR1EDmxyFqPB+fmYbn6QBWMTfnwsZzGy61NsMz mF6fLmql2E0CunCbdyhLR+pML2y69CDxGe9T/dMpbuq7BSFdrE71V/dYnd6olRQN1m3q b7/qWHQefOb5FfrU/MfHPYKTwIHP4783k6yKQ3VurbquowJuiKfUaEXQyaECjZRh/lFf WJCO9D+F0nISJhSY2h4A09XqL5y83TYH/R8PJJkrmuBzZzA9yTm0kFWxdpAd35I+3qCd M+597QxdnoO0wtCpaHEr8SrcpFBi8iZbR1WuVN3htteJgjUTQEV7rBaF9WCCLOgvks73 khpA== 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=HYuxrnF9ykGCGcUDcjpZlzKkwAJB/1qRfYGqPUiH6Qw=; b=AErDRwGvdnKPnvzY+T/uHwmP/7FltrZN588/tOWj9x2hzQXgiu3FimRI7zfn08bfer ff4jjQr1LSKptaQL7Dd1QvBSG0GtczoTCz8Bm79AcIOWbzU2jw5s6h99K2ELb7czlFcb 1hjWSPIe+oNLPHBa5dRP5OZzHVHZMTzv48xkMTqY8KdKD+GG0emy+9d3BnAIqN2y7T9R hK8BNizzNT9CgVHTngZ8Sg84/akHuAO88d9qrxotLRrHi94fqu6jYtpzKrArfCA/KxjK XHSBZRZA+Gp5hLtXzp8qt7rYuFBhXC3yjs77NrP300MK69w/NujlSzCNkn9i8Zcd9k1t ieww== 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 q3si3620182plh.283.2021.10.08.02.30.56; Fri, 08 Oct 2021 02:31:09 -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 S238078AbhJHJb0 (ORCPT + 99 others); Fri, 8 Oct 2021 05:31:26 -0400 Received: from mx22.baidu.com ([220.181.50.185]:38414 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238235AbhJHJbR (ORCPT ); Fri, 8 Oct 2021 05:31:17 -0400 Received: from BC-Mail-Ex15.internal.baidu.com (unknown [172.31.51.55]) by Forcepoint Email with ESMTPS id F0B3D676A9121E31F75; Fri, 8 Oct 2021 17:29:20 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex15.internal.baidu.com (172.31.51.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Fri, 8 Oct 2021 17:29:20 +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; Fri, 8 Oct 2021 17:29:19 +0800 From: Cai Huoqing To: CC: Linus Walleij , Jonathan Cameron , Lars-Peter Clausen , Shawn Guo , Sascha Hauer , "Pengutronix Kernel Team" , Fabio Estevam , "NXP Linux Team" , Vladimir Zapolskiy , "Neil Armstrong" , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Andy Gross , "Bjorn Andersson" , Heiko Stuebner , Philipp Zabel , , , , , , Subject: [PATCH v4 8/9] iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe() Date: Fri, 8 Oct 2021 17:28:56 +0800 Message-ID: <20211008092858.495-8-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211008092858.495-1-caihuoqing@baidu.com> References: <20211008092858.495-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex14.internal.baidu.com (172.31.51.54) 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(). v3->v4: *Handle devm_reset_control_get_exclusive() by dev_err_probe(). *Handle platform_get_irq() that returns -EPROBE_DEFER. drivers/iio/adc/rockchip_saradc.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index a56a0d7337ca..14b8df4ca9c8 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -360,7 +360,8 @@ static int rockchip_saradc_probe(struct platform_device *pdev) if (IS_ERR(info->reset)) { ret = PTR_ERR(info->reset); if (ret != -ENOENT) - return ret; + return dev_err_probe(&pdev->dev, ret, + "failed to get saradc-apb\n"); dev_dbg(&pdev->dev, "no reset control found\n"); info->reset = NULL; @@ -370,7 +371,7 @@ static int rockchip_saradc_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq < 0) - return irq; + return dev_err_probe(&pdev->dev, irq, "failed to get irq\n"); ret = devm_request_irq(&pdev->dev, irq, rockchip_saradc_isr, 0, dev_name(&pdev->dev), info); @@ -380,23 +381,19 @@ static int rockchip_saradc_probe(struct platform_device *pdev) } info->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); - if (IS_ERR(info->pclk)) { - dev_err(&pdev->dev, "failed to get pclk\n"); - return PTR_ERR(info->pclk); - } + if (IS_ERR(info->pclk)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->pclk), + "failed to get pclk\n"); info->clk = devm_clk_get(&pdev->dev, "saradc"); - if (IS_ERR(info->clk)) { - dev_err(&pdev->dev, "failed to get adc clock\n"); - return PTR_ERR(info->clk); - } + if (IS_ERR(info->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->clk), + "failed to get adc clock\n"); info->vref = devm_regulator_get(&pdev->dev, "vref"); - if (IS_ERR(info->vref)) { - dev_err(&pdev->dev, "failed to get regulator, %ld\n", - PTR_ERR(info->vref)); - return PTR_ERR(info->vref); - } + if (IS_ERR(info->vref)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->vref), + "failed to get regulator\n"); if (info->reset) rockchip_saradc_reset_controller(info->reset); -- 2.25.1