From patchwork Wed May 19 06:39:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 443004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27C3BC43461 for ; Wed, 19 May 2021 06:40:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01FCA6135C for ; Wed, 19 May 2021 06:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbhESGlW (ORCPT ); Wed, 19 May 2021 02:41:22 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:14362 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230154AbhESGlV (ORCPT ); Wed, 19 May 2021 02:41:21 -0400 X-UUID: 2ec47a64f7ac406c99535156bf549207-20210519 X-UUID: 2ec47a64f7ac406c99535156bf549207-20210519 Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 591877477; Wed, 19 May 2021 14:39:58 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 May 2021 14:39:54 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 May 2021 14:39:53 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Thierry Reding CC: Liam Girdwood , Mark Brown , Matthias Brugger , Chunfeng Yun , Paul Cercueil , Lee Jones , , , , Subject: [PATCH v2 2/3] usb: common: usb-conn-gpio: use dev_err_probe() to print log Date: Wed, 19 May 2021 14:39:45 +0800 Message-ID: <1621406386-18838-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1621406386-18838-1-git-send-email-chunfeng.yun@mediatek.com> References: <1621406386-18838-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 730A46FE6FA82AE1E7BACAD98544DE91B3AC4C7E7FA83417CA21920A6BC81EF42000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Use dev_err_probe() to print debug or error message depending on whether the error value is -DPROBE_DEFER or not. Signed-off-by: Chunfeng Yun --- v2: no changes --- drivers/usb/common/usb-conn-gpio.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c index c9545a4eff66..dfbbc4f51ed6 100644 --- a/drivers/usb/common/usb-conn-gpio.c +++ b/drivers/usb/common/usb-conn-gpio.c @@ -223,18 +223,14 @@ static int usb_conn_probe(struct platform_device *pdev) } if (IS_ERR(info->vbus)) { - if (PTR_ERR(info->vbus) != -EPROBE_DEFER) - dev_err(dev, "failed to get vbus: %ld\n", PTR_ERR(info->vbus)); - return PTR_ERR(info->vbus); + ret = PTR_ERR(info->vbus); + return dev_err_probe(dev, ret, "failed to get vbus :%d\n", ret); } info->role_sw = usb_role_switch_get(dev); - if (IS_ERR(info->role_sw)) { - if (PTR_ERR(info->role_sw) != -EPROBE_DEFER) - dev_err(dev, "failed to get role switch\n"); - - return PTR_ERR(info->role_sw); - } + if (IS_ERR(info->role_sw)) + return dev_err_probe(dev, PTR_ERR(info->role_sw), + "failed to get role switch\n"); ret = usb_conn_psy_register(info); if (ret)