Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1493419pxb; Thu, 16 Sep 2021 08:35:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRaW65yLnKTi4Zts1NEW9euk/9zj4c35SwzeYU1JA5zMivkahmLv1saOGXpA9o8+F0boe6 X-Received: by 2002:a05:6402:1a2f:: with SMTP id be15mr7221426edb.246.1631806526984; Thu, 16 Sep 2021 08:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631806526; cv=none; d=google.com; s=arc-20160816; b=zjWouzktAI7sVj6tduJQ27eEhyYE50MjX4Zl3Nd26lUenen6+q8fbocOxeNptmObnS RKAA4S3eE/FZQ3VXBTsY/X9w0Ngil8IrMlL7q/sVInhOFQTChrBMMJ07IbC43iVTA/AM guXiE255pv2SA6RCdpnLL7639OP+Lx/XmCMgxL5kn6DRTF4EgQB/X664TPAuRsp7hItY uXvcwaBwVSW8MbCoF+TX2Ptk2b/7BUbmz3DULB0kel8+aZirXFstvXeLokgOaMDrs94I EollbekoQVcSUzLNBUtRrpcylD4KAvdojchBZsPm1knI4cRtZn2Ngmk8VD6hjdruRyxT STRQ== 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=DA6z//eXNH4dE5D8NTIGRMckFpK65oy2J5xCSG0e4bM=; b=qMlvAa96/mtWnbvO4o3PXycC8bDaskn1zoKAJyU6gvY4i1yynHMkbw5zaN+32KjKIi IoAhHhksYxDZP3meJZMxF0g7YLTM+vBbm6QBQAR+OhrXxbUL67o1Y2aENaB86pM6nW/x /JdEIwaTpyx8AhWoVzubLFJ5ZMbC972tI/8+SCcGjhL9bwRKYQA9GrWYOcd2a3t3kWo7 3a4ocJG2o5BnhJdDQQkAAcKql3K5zghPyVyAz6sXCwe/YmTLH6YeBn4pxmEFrVGvABXj vgyKqVdjve/DcQpzTN++zrNcY6GAap20PdntadgKjWWDoz0nqx/mJam8LMd0vqr3HwTl tkMQ== 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 my49si3639801ejc.46.2021.09.16.08.35.02; Thu, 16 Sep 2021 08:35:26 -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 S239253AbhIPPdF (ORCPT + 99 others); Thu, 16 Sep 2021 11:33:05 -0400 Received: from mx22.baidu.com ([220.181.50.185]:33020 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239233AbhIPPdD (ORCPT ); Thu, 16 Sep 2021 11:33:03 -0400 Received: from BC-Mail-Ex05.internal.baidu.com (unknown [172.31.51.45]) by Forcepoint Email with ESMTPS id 953F91D5A16DBAE0E792; Thu, 16 Sep 2021 23:31:39 +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; Thu, 16 Sep 2021 23:31:39 +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:31:38 +0800 From: Cai Huoqing To: CC: Dmitry Torokhov , , Subject: [PATCH] Input: bu21013_ts - Make use of the helper function dev_err_probe() Date: Thu, 16 Sep 2021 23:31:33 +0800 Message-ID: <20210916153134.13939-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-Ex11.internal.baidu.com (172.31.51.51) 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/bu21013_ts.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index 2f1f0d7607f8..43cc7efd4e38 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -477,10 +477,9 @@ static int bu21013_probe(struct i2c_client *client, } ts->regulator = devm_regulator_get(&client->dev, "avdd"); - if (IS_ERR(ts->regulator)) { - dev_err(&client->dev, "regulator_get failed\n"); - return PTR_ERR(ts->regulator); - } + if (IS_ERR(ts->regulator)) + return dev_err_probe(&client->dev, PTR_ERR(ts->regulator), + "regulator_get failed\n"); error = regulator_enable(ts->regulator); if (error) { @@ -497,11 +496,9 @@ static int bu21013_probe(struct i2c_client *client, /* Named "CS" on the chip, DT binding is "reset" */ ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); error = PTR_ERR_OR_ZERO(ts->cs_gpiod); - if (error) { - if (error != -EPROBE_DEFER) - dev_err(&client->dev, "failed to get CS GPIO\n"); - return error; - } + if (error) + return dev_err_probe(&client->dev, error, + "failed to get CS GPIO\n"); gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS"); error = devm_add_action_or_reset(&client->dev, @@ -516,11 +513,8 @@ static int bu21013_probe(struct i2c_client *client, ts->int_gpiod = devm_gpiod_get_optional(&client->dev, "touch", GPIOD_IN); error = PTR_ERR_OR_ZERO(ts->int_gpiod); - if (error) { - if (error != -EPROBE_DEFER) - dev_err(&client->dev, "failed to get INT GPIO\n"); - return error; - } + if (error) + return dev_err_probe(&client->dev, error, "failed to get INT GPIO\n"); if (ts->int_gpiod) gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT"); -- 2.25.1