Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1494565pxb; Thu, 16 Sep 2021 08:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymaDm8zwum5Gey2qGyAgRaf6zQOQxtqQJZa+b0Aqt3+iyTlCjv9jkmCYtCtIv3wi4LSr6O X-Received: by 2002:a17:906:48e:: with SMTP id f14mr3764796eja.433.1631806615262; Thu, 16 Sep 2021 08:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631806615; cv=none; d=google.com; s=arc-20160816; b=ayC/ADtCpi/yO0B+BhnAw4N2B2//N/DUNpGQU6LucoMuE+REyV5+/1OC3MOzrZOfdz e1zgcB/swpgDeMW4AUdNPJnTao/ZK7WlFcM+3KNg8Xl0xWLvIPxv+f4bb5DGqKNpH72x l5B5ZHhc3Kqnk1Fp7CQFck3eOGny1QjHsDipCgDNAflJKtk0OO+YvTZ/s5emzzBD7vw5 C4rlzqsfQTpq9sh/6nBW73FF1gBZVdMzbnTFiLBs15ysRaHGLGoqzXrZPVYq8La7U/ap 4jynU1l1x2RD0/G2lCAj1GWoOyF1vCUzG3ohg2AGMQTY30UJj+isgtpx2Yt/a1FVA28S xDsw== 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=Hg38XtQoUYA8msDCNLq/A3BgBUEGm1T6ACwdun80WbI=; b=P0pnFur4LZ4+Vmfnkx0v902l+cnd90UxR/drRIxKC+0kbE5+OnUo1AJFz8I8uh0Kzl 4NQpDMPNLxtF7P4N9u8NJZGfoOYF+AsBPpvI0ASEkBYiASfYcWstZha9EcsO1g6mMRRm cxaLDJuatf5RrhnVypU+BBVqdSd2qv3qua/UiyVzJghA/Rv6Lw1Z1FLlzbDQXweg/OLV HMtwI2+3VH69ThRlXQyrRT2Yhqszimz6xKJM/es61w1Gpx7fRwonZmhheiobxIOoRV1q I/5uW2rv0qrBK+o4qYWqfLhVSP42+f+tz65yTH8+7bZQih5GdAbzHi6X0G4xY7GptD+Q 2+og== 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 n13si3925801edt.68.2021.09.16.08.36.31; Thu, 16 Sep 2021 08:36:55 -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 S239852AbhIPPfM (ORCPT + 99 others); Thu, 16 Sep 2021 11:35:12 -0400 Received: from mx24.baidu.com ([111.206.215.185]:34648 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239664AbhIPPfB (ORCPT ); Thu, 16 Sep 2021 11:35:01 -0400 Received: from BC-Mail-Ex19.internal.baidu.com (unknown [172.31.51.13]) by Forcepoint Email with ESMTPS id 3BCD597CB2F0D6924A5A; Thu, 16 Sep 2021 23:33:39 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex19.internal.baidu.com (172.31.51.13) 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: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:33:38 +0800 From: Cai Huoqing To: CC: Dmitry Torokhov , , Subject: [PATCH] Input: mpr121_touchkey - Make use of the helper function dev_err_probe() Date: Thu, 16 Sep 2021 23:33:33 +0800 Message-ID: <20210916153333.14787-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/keyboard/mpr121_touchkey.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 40d6e5087cde..e4d416c30803 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -96,8 +96,8 @@ static struct regulator *mpr121_vdd_supply_init(struct device *dev) vdd_supply = devm_regulator_get(dev, "vdd"); if (IS_ERR(vdd_supply)) { - dev_err(dev, "failed to get vdd regulator: %ld\n", - PTR_ERR(vdd_supply)); + dev_err_probe(dev, PTR_ERR(vdd_supply), + "failed to get vdd regulator\n"); return vdd_supply; } @@ -267,11 +267,9 @@ static int mpr_touchkey_probe(struct i2c_client *client, error = device_property_read_u32_array(dev, "linux,keycodes", mpr121->keycodes, mpr121->keycount); - if (error) { - dev_err(dev, - "failed to read linux,keycode property: %d\n", error); - return error; - } + if (error) + return dev_err_probe(dev, error, + "failed to read linux, keycode property\n"); input_dev->name = "Freescale MPR121 Touchkey"; input_dev->id.bustype = BUS_I2C; -- 2.25.1