Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1495073pxb; Thu, 16 Sep 2021 08:37:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8GNNkLQD19mK0+i7xmtnc8z+zZ6QgRWmuOrSmgh1XS+OuzluspVvgiKvikpHHZdZle22f X-Received: by 2002:a05:6402:5206:: with SMTP id s6mr7130833edd.135.1631806655141; Thu, 16 Sep 2021 08:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631806655; cv=none; d=google.com; s=arc-20160816; b=o72oIdUwLlvkhZPP5wCpj1A2gctAUor9v/gldmrrvmyJlcf3goINarxNab9WtudkJ0 Z0TomjsJxltIlW80xoCt2PMMc1xZ1vPu2Z4mFQ8XqSg9rX1OFDXfirS3ztg0MCnGTPi0 e3logvGt2aoYYPV6Pu3B/wOFSBc88y+RCTXmEkpHfmwSWbWoXVefLKf4YiIlm4iAJkiH /XzlrhgkZ6RLPWTiJnwmVt7dkHx7DCQgoUdmteW3xSw94pvEYRYQB0VcAuRIqB/+m3zR gij+Ento5jOePrLdhPE5iNI9UxvThW+cspqADf5KI2fRmwR/sPQXtlAEW3+jT3j5Srdf Xa2w== 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=ff+2CongaSONhg5aiz+GL7rnGq8GYubCySaNS4pBAMg=; b=SoRaN9s15BMwAjpvL8YSmH4YHoKst5X4Aob4Cv3HtYyv471gyJBWOOGn/AnZSmYO+c 0uQ7tYHExoZWZvCncQieac0v7Pd0LImGJvpouqU8QOVhXm7qjkb/aTiDhDPedJYnbO4S SOnJ+Yb7gC/o66DZGLRWXU028Dpz6eCyNUNm6P6YoObbGN0SWuOvTGp01jUwqOtoHu3n nsPFl2Rnb/y3RCejnBhpiUi/3BXA/BVK4NYbMo6VgoqfmKTDmFeVwhyIWizAbHj+auGo RZWsagN+8xh7TFZ9YxiC5ASUuFGSPsLT5PPxqojgtt81ARTs3P7w+Dx9ZIEsBCaI6xKt ft5w== 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 d5si3571051ejm.652.2021.09.16.08.37.11; Thu, 16 Sep 2021 08:37:35 -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 S239281AbhIPPdR (ORCPT + 99 others); Thu, 16 Sep 2021 11:33:17 -0400 Received: from mx22.baidu.com ([220.181.50.185]:33090 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239306AbhIPPdM (ORCPT ); Thu, 16 Sep 2021 11:33:12 -0400 Received: from BC-Mail-Ex03.internal.baidu.com (unknown [172.31.51.43]) by Forcepoint Email with ESMTPS id 19DDE974C9EC6A481D29; Thu, 16 Sep 2021 23:31:47 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex03.internal.baidu.com (172.31.51.43) 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:46 +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:46 +0800 From: Cai Huoqing To: CC: Dmitry Torokhov , , Subject: [PATCH] Input: bu21029_ts - Make use of the helper function dev_err_probe() Date: Thu, 16 Sep 2021 23:31:40 +0800 Message-ID: <20210916153141.13992-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/bu21029_ts.c | 28 +++++++++----------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c index 392950aa7856..dd4738761848 100644 --- a/drivers/input/touchscreen/bu21029_ts.c +++ b/drivers/input/touchscreen/bu21029_ts.c @@ -353,30 +353,20 @@ static int bu21029_probe(struct i2c_client *client, error = device_property_read_u32(&client->dev, "rohm,x-plate-ohms", &bu21029->x_plate_ohms); - if (error) { - dev_err(&client->dev, - "invalid 'x-plate-ohms' supplied: %d\n", error); - return error; - } + if (error) + return dev_err_probe(&client->dev, error, + "invalid 'x-plate-ohms' supplied\n"); bu21029->vdd = devm_regulator_get(&client->dev, "vdd"); - if (IS_ERR(bu21029->vdd)) { - error = PTR_ERR(bu21029->vdd); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "failed to acquire 'vdd' supply: %d\n", error); - return error; - } + if (IS_ERR(bu21029->vdd)) + return dev_err_probe(&client->dev, PTR_ERR(bu21029->vdd), + "failed to acquire 'vdd' supply\n"); bu21029->reset_gpios = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(bu21029->reset_gpios)) { - error = PTR_ERR(bu21029->reset_gpios); - if (error != -EPROBE_DEFER) - dev_err(&client->dev, - "failed to acquire 'reset' gpio: %d\n", error); - return error; - } + if (IS_ERR(bu21029->reset_gpios)) + return dev_err_probe(&client->dev, PTR_ERR(bu21029->reset_gpios), + "failed to acquire 'reset' gpio\n"); in_dev = devm_input_allocate_device(&client->dev); if (!in_dev) { -- 2.25.1