Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3743846pxb; Mon, 27 Sep 2021 01:18:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykO9zNRlHAggEGMrxOHdNABsfZzqHA+46btGm/TERAydZedWNovFBM/oEUTi5YYaRHQg0J X-Received: by 2002:aa7:ca45:: with SMTP id j5mr22191515edt.6.1632730732979; Mon, 27 Sep 2021 01:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632730732; cv=none; d=google.com; s=arc-20160816; b=ttK27qA3mL9D2OmU9Q9+w7A06hF5tGJQ4DBkJq/x55zDjoRGEBQkVL/eDQeCWsDP/B 8WpgIQFx3DYppp/I7hIXiV0yVy0klvmeFtjM1hohqCFzw6vNb47VxpCND+rusOy+6c7W jijqSNnRBfi75EOqa7bJLDkqDBAXSh85UV+uRCXc/7PMSRe+nGfgI2HL6Du1sE+vtS9i Ahlqb4k54YwxfOu6yOWmnyKBp8VPrSERVFTWKkCAVPlL0SGDC76BonSZTvNPx1R2wdmi oeNdCr8QmhCQS1YDlA9VrcPfkyiuwW8eJg2/a18P0JvBW/CJpLGYHDWRZS9AbrYdrGNn VZUQ== 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=t7CPTtjPQX6BIE+1uSXTXBniBRq4l6a+jaT9MDWnfxM=; b=jPyGsKHXe8DA3IRdXk1zpaKIG+xx2xqIzXMH+KgP3vM3WhmvR7Pcp7ffBQx+GgEg9k N0Y6VyUZLGZBIZ2jfeZXQ5WYXkdjmOWjGmJpsTAjDoKT9LSQBedjCLSAVnyKA9fFEneF xglEziNevWEbITJzZUgxBrdoKO+niNO0nkI8Z88DKu0kldS3x1MuCTpYCkW3n6rHsg6e O6mqspIVrobQslfohbFr/xXScKMZ5oQ2MgQeYz320furYzPzbPn1kj5r8Ur+Q4K8iyQw XMr3FgJI9CVmRS2FbK53KkQDsx1oesibdJ9Gk+bR/rLuIzpmPGNfr41GIb3M3MSuM80i 64KA== 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 7si17058215ejk.598.2021.09.27.01.18.30; Mon, 27 Sep 2021 01:18:52 -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 S233382AbhI0IQ0 (ORCPT + 99 others); Mon, 27 Sep 2021 04:16:26 -0400 Received: from mx24.baidu.com ([111.206.215.185]:42492 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233349AbhI0IQZ (ORCPT ); Mon, 27 Sep 2021 04:16:25 -0400 Received: from BC-Mail-Ex05.internal.baidu.com (unknown [172.31.51.45]) by Forcepoint Email with ESMTPS id AE2AF60B385B9141CF8A; Mon, 27 Sep 2021 16:14:41 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex05.internal.baidu.com (172.31.51.45) 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:14:40 +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:14:40 +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 , , , , , , Subject: [PATCH 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:14:18 +0800 Message-ID: <20210927081426.762-2-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927081426.762-1-caihuoqing@baidu.com> References: <20210927081426.762-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex10.internal.baidu.com (172.31.51.50) 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/adc/imx7d_adc.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c index 4969a5f941e3..f47360cbff3b 100644 --- a/drivers/iio/adc/imx7d_adc.c +++ b/drivers/iio/adc/imx7d_adc.c @@ -496,19 +496,13 @@ static int imx7d_adc_probe(struct platform_device *pdev) return irq; info->clk = devm_clk_get(dev, "adc"); - if (IS_ERR(info->clk)) { - ret = PTR_ERR(info->clk); - dev_err(dev, "Failed getting clock, err = %d\n", ret); - return ret; - } + if (IS_ERR(info->clk)) + return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n"); info->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(info->vref)) { - ret = PTR_ERR(info->vref); - dev_err(dev, - "Failed getting reference voltage, err = %d\n", ret); - return ret; - } + if (IS_ERR(info->vref)) + return dev_err_probe(dev, PTR_ERR(info->vref), + "Failed getting reference voltage\n"); platform_set_drvdata(pdev, indio_dev); -- 2.25.1