Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2178205pxb; Fri, 8 Oct 2021 02:31:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjJjdgVIYOUkVMdnVOfSXzUOSuQHoUYxLlbh2W22ko1wArP5jomk5PQC6nppqZNYaRAMjn X-Received: by 2002:a62:be14:0:b0:44c:c997:6700 with SMTP id l20-20020a62be14000000b0044cc9976700mr6954974pff.80.1633685478850; Fri, 08 Oct 2021 02:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685478; cv=none; d=google.com; s=arc-20160816; b=D3vTa4NB/OF2Wqbv7REqCvwSg55PuTH6nTpGKeCz+x9qqRbSDGH5rrVFzFTBRZw1I+ ifuIse9kjFJmw1f18rJi04dxz8yu7giTfP9T9nzHvf6az3ZDtKCFsHRZfPcTJ4GXDqQC HeCFDFWmRU7txoTFKGgis4MF2Ekpg5nwWzoyL91U+8V7sjW54O1rOQUTXG/nb65mpVO5 SUJdNG5CGgipMdGTgewIHw6lJa6DnqwGUokx96Ih+NexDEAX1HQgclVflfVF8G0U0CsT K+rPnZiC+1hrN/71r2QNEolWvztamBmbNkg8fI5klVXZXgraiHJqrQ4PLUGcSwbY9Rut aSUw== 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=14kGSCFg7T0S46UNY6AAylaeLopzZFHTA2RU/k0QPAk=; b=cK6XrToowmG68z8fqSonTB7GP0758Jek4EqCWJ23SDfIhGStPITdZivW95/3dL/2Rh JpDevKyD4o3EUSamS1MyG7bgNgMkh6gvLLfj4EKAbS2ycdZwet2AVTkDZZExJA7I6Mue MK8UVe7C1Gxn98ZmtlxKg7eRf6ZRDrrEa21Ut5JziLLb2O0pVUnVDlkimH2SSAhA0EZA gPGkjka+XP7hkHpy1UTA37EWFa9xZ7mZz8YGslWwMY3v+Wd3FBMqKqJmo+hJakFKYh1Z phYcJRAcvaPxibFToneQCTVNrIQJTC5H8TAdOjKUN5dQoQTWF/UnKij16XlxERjdBg2Y 4++w== 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 y30si777958pgk.563.2021.10.08.02.31.06; Fri, 08 Oct 2021 02:31:18 -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 S237470AbhJHJa5 (ORCPT + 99 others); Fri, 8 Oct 2021 05:30:57 -0400 Received: from mx22.baidu.com ([220.181.50.185]:37166 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235969AbhJHJa4 (ORCPT ); Fri, 8 Oct 2021 05:30:56 -0400 Received: from BJHW-Mail-Ex11.internal.baidu.com (unknown [10.127.64.34]) by Forcepoint Email with ESMTPS id 01DB11B09D55DF7346B2; Fri, 8 Oct 2021 17:28:59 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex11.internal.baidu.com (10.127.64.34) 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:28:58 +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:28:57 +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 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe() Date: Fri, 8 Oct 2021 17:28:49 +0800 Message-ID: <20211008092858.495-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-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(). v2: Reviewed-by: Linus Walleij v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER. drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c index 7b5212ba5501..4c46a201d4ef 100644 --- a/drivers/iio/adc/ab8500-gpadc.c +++ b/drivers/iio/adc/ab8500-gpadc.c @@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) return ret; gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END"); - if (gpadc->irq_sw < 0) { - dev_err(dev, "failed to get platform sw_conv_end irq\n"); - return gpadc->irq_sw; - } + if (gpadc->irq_sw < 0) + return dev_err_probe(dev, gpadc->irq_sw, + "failed to get platform sw_conv_end irq\n"); if (is_ab8500(gpadc->ab8500)) { gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END"); - if (gpadc->irq_hw < 0) { - dev_err(dev, "failed to get platform hw_conv_end irq\n"); - return gpadc->irq_hw; - } + if (gpadc->irq_hw < 0) + return dev_err_probe(dev, gpadc->irq_hw, + "failed to get platform hw_conv_end irq\n"); } else { gpadc->irq_hw = 0; } @@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) /* The VTVout LDO used to power the AB8500 GPADC */ gpadc->vddadc = devm_regulator_get(dev, "vddadc"); - if (IS_ERR(gpadc->vddadc)) { - ret = PTR_ERR(gpadc->vddadc); - dev_err(dev, "failed to get vddadc\n"); - return ret; - } + if (IS_ERR(gpadc->vddadc)) + return dev_err_probe(dev, PTR_ERR(gpadc->vddadc), + "failed to get vddadc\n"); ret = regulator_enable(gpadc->vddadc); if (ret) { -- 2.25.1