Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4473572pxb; Mon, 27 Sep 2021 18:41:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6K7l0+DxnK0CNEteHMe5ZYy1LeUCcqs4HTdvX3wIuTIzgSobKULA/nE4v9/3nC+YjK7TO X-Received: by 2002:a65:44c5:: with SMTP id g5mr2306588pgs.39.1632793294105; Mon, 27 Sep 2021 18:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632793294; cv=none; d=google.com; s=arc-20160816; b=bLw8rzYRtDMKzUMRk/QFFEK/Q9QJxix2Rc1iUwoM+0yzPN+zjY9muCKJwi2L0iXdEf MmLjT4Y95xubMa5JORSPK3dVJ7W5ftmuadLLiZaVZIS89fa5mvt781hA4hbzc2UwGDVg hYPXv2re57QBgh3MbZBNgt/LoOEBmjLEzRO0LonaqmWzJDsebR0+7Hx9PNiy7N5lfmBv /EawYugBNd4LWWaksvj6Rr6uQTPC/NsKJaKhYr6uEGG/jbic/LowljfVWCLgcRv9wRmD fUNqkdxmsOGxKjtrR5QPhmldrazGrrHWhwjp8ZhkZMCkLjzse48zhVfx9o+uNovmeg5d kcbA== 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=7Cc4yqAQsbr4AwDrjiGzlnIPUwxwFH4bDEbK7aFLXVU=; b=Xiwu3DZIp2LJ7R+NeeEKk0BZoOsTkB1981Gb/3swBdYiHZGiG1I8o/0yNGbJyIOV9J 0Mz6WqbFQo5EaTdQBvXreOOyC5mIMGtkmuTW+N+dx7ba7FK+XdoE4mKH476ju/lUdQw+ EaorEI03LMLQhCR8ps9riMfVeOO+ExR9AzZ9N5KIuUVEIN6Dc6/w4Wh5ymbUsGaIReZq CqZllskAil5D1kgb3KuJHH/6rFHA4uoTHNGhCAlBTHM5m9jAgbkgAvGKvKxKFSm5KE01 DunHLaj7EuOv6R+tEVINValXEK2+7KSq4FTUPb4w1Dmyv9ZYwocX93HqohHigWStFhOD TqJg== 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 a84si22912046pfd.77.2021.09.27.18.41.20; Mon, 27 Sep 2021 18:41:34 -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 S238567AbhI1BlF (ORCPT + 99 others); Mon, 27 Sep 2021 21:41:05 -0400 Received: from mx24.baidu.com ([111.206.215.185]:47902 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238515AbhI1BlB (ORCPT ); Mon, 27 Sep 2021 21:41:01 -0400 Received: from BC-Mail-Ex06.internal.baidu.com (unknown [172.31.51.46]) by Forcepoint Email with ESMTPS id B4030C7FF096BEFD9B55; Tue, 28 Sep 2021 09:39:21 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex06.internal.baidu.com (172.31.51.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 28 Sep 2021 09:39:21 +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; Tue, 28 Sep 2021 09:39:20 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH v2 4/8] iio: dac: ds4424: Make use of the helper function dev_err_probe() Date: Tue, 28 Sep 2021 09:38:57 +0800 Message-ID: <20210928013902.1341-4-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210928013902.1341-1-caihuoqing@baidu.com> References: <20210928013902.1341-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex24.internal.baidu.com (172.31.51.18) 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/ds4424.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c index 79527fbc250a..5a5e967b0be4 100644 --- a/drivers/iio/dac/ds4424.c +++ b/drivers/iio/dac/ds4424.c @@ -232,12 +232,9 @@ static int ds4424_probe(struct i2c_client *client, indio_dev->name = id->name; data->vcc_reg = devm_regulator_get(&client->dev, "vcc"); - if (IS_ERR(data->vcc_reg)) { - dev_err(&client->dev, - "Failed to get vcc-supply regulator. err: %ld\n", - PTR_ERR(data->vcc_reg)); - return PTR_ERR(data->vcc_reg); - } + if (IS_ERR(data->vcc_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vcc_reg), + "Failed to get vcc-supply regulator.\n"); mutex_init(&data->lock); ret = regulator_enable(data->vcc_reg); -- 2.25.1