Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2177685pxb; Fri, 8 Oct 2021 02:30:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXFtCDy8nP5CZlEc3ERTbIYaEhHuMo2Hrd7kUbwMZcD6qp9OSAdcyTyDl8/tcFycQlO22r X-Received: by 2002:aa7:991e:0:b0:44c:a172:e670 with SMTP id z30-20020aa7991e000000b0044ca172e670mr9297101pff.10.1633685431308; Fri, 08 Oct 2021 02:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633685431; cv=none; d=google.com; s=arc-20160816; b=r5Z7l9jgicj9sw7cm6VW7V6/9gxGnnKT9NR0dzUNbmypyYmc4wRRFuno3jYtwn5POu KbaWyMHGfo3sLrXH3xBMGBlUwX/azIwypjSvnESjWpi9grD1sAYlv6sgGceq10fdqIDt 0XUYnsxnift5RbKqpuTY/6I28juyv8EL54/mDNYN14E9pYEBSy5Mvgh4Uhy7UOg/fEHf 06KgNEa1pGAkgxUFGzHQuhNtc533ISIt8B0p0wtVkNDDZa21GdADd1Vrz9tQh4Mb6skR KC2r87hFilEGglszTTY9cXj1k3tOv4gwwRUdZOd0Pl6jbbY1sA7xn9ea/i+lyGodeoVs 514A== 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=Ie4fL0JVd9GzvcllRMFpH1ZcHh2s0iLh9nIIpTut8/A=; b=KThLEo1qhH0RTqJ9zzsCCePCYD53OGzF39AKjQXObP0LJDdj2CZ9tla2Acsd9XVTEI WlaAvDUKoVLIU4Bec4y6/0k6GGUYdVkeIbUlbnVQghRPbsqqUvHxsUtQqpsvQCSUdhvh J2ZA9LzDaY9ptKxKvWW3yvdo3bnz1hrT7+vgSLgDpZ/sqHQnvz5Keed7U6wNYb2Qd9wG Z9d4SRcBuRp03ZuuPugj6FLYmGbXVv+sqmt6wZqV7d+H2qkNZRwoU+L5L7GqvxLfuGPp G6YChGlR89RUT1XHZcIl3fD3ljJnUl65E7w49PYj0os+iRkHN/F06+6WnmIvY351teRN IrFw== 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 k14si2787496pgg.114.2021.10.08.02.30.18; Fri, 08 Oct 2021 02:30:31 -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 S238771AbhJHJbH (ORCPT + 99 others); Fri, 8 Oct 2021 05:31:07 -0400 Received: from mx24.baidu.com ([111.206.215.185]:37730 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238675AbhJHJbF (ORCPT ); Fri, 8 Oct 2021 05:31:05 -0400 Received: from BJHW-Mail-Ex14.internal.baidu.com (unknown [10.127.64.37]) by Forcepoint Email with ESMTPS id 990FF4FF3CDB6B75BF7F; Fri, 8 Oct 2021 17:29:08 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex14.internal.baidu.com (10.127.64.37) 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:08 +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:07 +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 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe() Date: Fri, 8 Oct 2021 17:28:52 +0800 Message-ID: <20211008092858.495-4-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) X-Baidu-BdMsfe-DateCheck: 1_BJHW-Mail-Ex14_2021-10-08 17:29:08:562 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/max1118.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c index 8cec9d949083..a41bc570be21 100644 --- a/drivers/iio/adc/max1118.c +++ b/drivers/iio/adc/max1118.c @@ -221,10 +221,9 @@ static int max1118_probe(struct spi_device *spi) if (id->driver_data == max1118) { adc->reg = devm_regulator_get(&spi->dev, "vref"); - if (IS_ERR(adc->reg)) { - dev_err(&spi->dev, "failed to get vref regulator\n"); - return PTR_ERR(adc->reg); - } + if (IS_ERR(adc->reg)) + return dev_err_probe(&spi->dev, PTR_ERR(adc->reg), + "failed to get vref regulator\n"); ret = regulator_enable(adc->reg); if (ret) return ret; -- 2.25.1