Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1493734pxb; Thu, 16 Sep 2021 08:35:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmGtUCMSElQ5wx7PRsGVlBjHAAhW5FTW5MQIMGtZy4WmA82X4SN1b52YeZY/AsL48NtUO3 X-Received: by 2002:a6b:f007:: with SMTP id w7mr4918404ioc.112.1631806551918; Thu, 16 Sep 2021 08:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631806551; cv=none; d=google.com; s=arc-20160816; b=fB6xQ+ux0N08dpVgu6zXcxewAEhcpcaZjoEEs6Ka+ZCY7TdUZVV7GabhTmA4ZVRttH tPsX8Dga//tTBOb6yB8O8e1QudUai3qi97v9iSUUgF4W/1oTeIdKteIfBulDf95efToY REHmWxAHz3irwABV3nAMhPh+C+BxMD38L9xF/V5GPiA4ZrwPPJ1duKX19v2RP/jfQf6v ZwqQYcrr6hhzE5R9NI6v8ZPlieNOjdgcyc5CNQpo6sBzB82TV/1DD2gNP95IkS+B1iAm taKSr0JwAdbavKC6f6wLtAr0//hApBC6LotfX1rVaW7aCZiO97A/YFnDOAhOQpj6Qczn yp6g== 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=KBX3ONJffW0Ow1DRO5p2fBCkAlFz9ZQVZ5o+419MCXo=; b=A6Ox1FLMid3LVHJD+B1DaJSLcxVmRNkJ+AeyhanLipROZaCCC4fXmO++IzpzcrsQkv LFrJr5psQu1ihr22+jCbCLvVsp0nsL//HrX55OR5L5bgQq33Q3KZ1/J3SmIU5Keae24N JCh0zSw7B13tZsYCLhRualHYq9yZg9mluc3jrvFymbGaJkFxMtKiQo+Cm4UkFaTaBsFS fSknA+U+2RzyvE/ADJcrT7GX7mYwxlp2N+QPyUWq/+bZDfhSXw1osJwg8TwCVyKpWBxP TCWqKBrNtqC3dVVW8euFfkiibXPUksDluev4PcOy0CefyM83Q/7WQNE09aK/By617zed t+0g== 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 a9si2808653ila.32.2021.09.16.08.35.39; Thu, 16 Sep 2021 08:35:51 -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 S238510AbhIPPfB (ORCPT + 99 others); Thu, 16 Sep 2021 11:35:01 -0400 Received: from mx24.baidu.com ([111.206.215.185]:34544 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239891AbhIPPey (ORCPT ); Thu, 16 Sep 2021 11:34:54 -0400 Received: from BC-Mail-Ex20.internal.baidu.com (unknown [172.31.51.14]) by Forcepoint Email with ESMTPS id E56B11E924A499AFBDD6; Thu, 16 Sep 2021 23:33:31 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex20.internal.baidu.com (172.31.51.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Thu, 16 Sep 2021 23:33:31 +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; Thu, 16 Sep 2021 23:33:31 +0800 From: Cai Huoqing To: CC: Dmitry Torokhov , , Subject: [PATCH] Input: mms114 - Make use of the helper function dev_err_probe() Date: Thu, 16 Sep 2021 23:33:25 +0800 Message-ID: <20210916153326.14734-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-Ex09.internal.baidu.com (172.31.51.49) 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/input/touchscreen/mms114.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 9fa3b0e421be..4b36db084d86 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -525,20 +525,14 @@ static int mms114_probe(struct i2c_client *client, i2c_set_clientdata(client, data); data->core_reg = devm_regulator_get(&client->dev, "avdd"); - if (IS_ERR(data->core_reg)) { - error = PTR_ERR(data->core_reg); - dev_err(&client->dev, - "Unable to get the Core regulator (%d)\n", error); - return error; - } + if (IS_ERR(data->core_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->core_reg), + "Unable to get the Core regulator\n"); data->io_reg = devm_regulator_get(&client->dev, "vdd"); - if (IS_ERR(data->io_reg)) { - error = PTR_ERR(data->io_reg); - dev_err(&client->dev, - "Unable to get the IO regulator (%d)\n", error); - return error; - } + if (IS_ERR(data->io_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->io_reg), + "Unable to get the IO regulator\n"); error = devm_request_threaded_irq(&client->dev, client->irq, NULL, mms114_interrupt, -- 2.25.1