From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CA41C433FE for ; Tue, 29 Nov 2022 06:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235566AbiK2GSB (ORCPT ); Tue, 29 Nov 2022 01:18:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234251AbiK2GR6 (ORCPT ); Tue, 29 Nov 2022 01:17:58 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 337666575; Mon, 28 Nov 2022 22:17:57 -0800 (PST) Received: from canpemm500010.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NLsZ13fKvzHw7M; Tue, 29 Nov 2022 14:17:13 +0800 (CST) Received: from [10.174.179.191] (10.174.179.191) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 14:17:54 +0800 Message-ID: Date: Tue, 29 Nov 2022 14:17:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] USB: FHCI: fix error return code in of_fhci_probe() To: Vincent MAILHOL CC: , , , References: <1669692810-26744-1-git-send-email-wangyufen@huawei.com> From: wangyufen In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.191] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500010.china.huawei.com (7.192.105.118) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/11/29 12:11, Vincent MAILHOL 写道: > On Tue. 29 nov. 2022 à 12:33, Wang Yufen wrote: >> Fix to return a negative error code of PTR_ERR(fhci->gpiods[i]) >> instead of 0. >> >> Fixes: a4efdb8a423b ("USB: FHCI: Switch to GPIO descriptors") >> Signed-off-by: Wang Yufen >> --- >> drivers/usb/host/fhci-hcd.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c >> index 95a4446..afef72a 100644 >> --- a/drivers/usb/host/fhci-hcd.c >> +++ b/drivers/usb/host/fhci-hcd.c >> @@ -639,6 +639,7 @@ static int of_fhci_probe(struct platform_device *ofdev) >> NULL, i, GPIOD_OUT_LOW); >> >> if (IS_ERR(fhci->gpiods[i])) { >> + ret = PTR_ERR(fhci->gpiods[i]) >> dev_err(dev, "incorrect GPIO%d: %ld\n", >> i, PTR_ERR(fhci->gpiods[i])); > > Can you add some extra clean-up and reuse ret in the dev_err()? > > dev_err(dev, "incorrect GPIO%d: %ld\n", i, ret); I prefer to reuse ret, just like other fhci->*** checks. This also keeps the code style consistent with the context. Will change in v2. Thanks. > > Alternatively you can also consider %pe to print the mnemotechnic > instead of the value: > > dev_err(dev, "incorrect GPIO%d: %pe\n", > i, fhci->gpiods[i]); > > > Yours sincerely, > Vincent Mailhol >