Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1196404pxa; Thu, 20 Aug 2020 05:21:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXJmi/9UMmV085hM5qUu4KvfkQpQ1UzcLogMZqt/BfzLVdPJ5lw7CpIcMBi1EVBk8IqK9P X-Received: by 2002:a05:6402:2216:: with SMTP id cq22mr2596855edb.294.1597926108482; Thu, 20 Aug 2020 05:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597926108; cv=none; d=google.com; s=arc-20160816; b=hk2+1LVvl82UGG3EQVwpJA97lRWBeSUWyjiEJzUt7twiDPQFDASMLcBSACVGHgS56R dAgHqUqcWbrun7PXOMMWdavO+TeEtlQEbaLhy5zYKP9rdAD/eTfkdx0E94yPnHKUtuAJ joDq8Yl5Bz2uZWCK2DFsgi2XqkDtxkl0fBTpcPg0ExdXKXxzIDbjA3K8uFlMBz18hrEX XmeIt76zJ57SPF1BK10XgMP2cMJJA7+CJD6IShy83ugcql9HFYgNg2Dh8rdcOnU1uOMN cCtDwixDaZQZW1iCMHsxMva11xAAFTX1/8bKBdL7T4GG8ZSwgiyeEKRI0evjqst6yP9Q /IrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=vE9heza0HOIBLBVFnjKiPi0FbOYZ8R1G+mCRZphOQqc=; b=MD4beYW/vvm5KyeqhBw97qGv/hg2pXXqeRXJa3eHQ29fL3hPO2xaFn8DS1gBtYFUeU Qo8mU/Q3w3cw4lslta3R1DSMuKklGAhhMPXdKt30UmJ0VGnznPaxMZaUTnK0tKAoW+Pa 6PNjZBaFLuXgGQcfe14qcBGXnUUYC3GA2naUVKwizcJgVB7h7h+RuxUkJe2DTF4d4qj9 gB8BZgwh6/6f+3KjrMa3sLTBp6OvytEkGlMUacjU97j8XgQRKpTxCpsWP2RauSOm+cuO td5IskjQ8WEVi2B8BAALfOfhz/wfWXnnNjGb0HLdBkRQlJpEUPx431uGJChDsMxrIQzB bFZw== 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 dm22si1185637ejc.191.2020.08.20.05.21.24; Thu, 20 Aug 2020 05:21:48 -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 S1728606AbgHTMUy (ORCPT + 99 others); Thu, 20 Aug 2020 08:20:54 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:12052 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729609AbgHTMUm (ORCPT ); Thu, 20 Aug 2020 08:20:42 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.13]) by rmmx-syy-dmz-app08-12008 (RichMail) with SMTP id 2ee85f3e6a814ba-e3f62; Thu, 20 Aug 2020 20:20:18 +0800 (CST) X-RM-TRANSID: 2ee85f3e6a814ba-e3f62 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr07-12007 (RichMail) with SMTP id 2ee75f3e6a7f13e-2fed8; Thu, 20 Aug 2020 20:20:17 +0800 (CST) X-RM-TRANSID: 2ee75f3e6a7f13e-2fed8 From: Tang Bin To: gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Tang Bin , Zhang Shengju Subject: [PATCH] usb: hcd: fix the error check Date: Thu, 20 Aug 2020 20:20:38 +0800 Message-Id: <20200820122038.18704-1-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the function usb_add_hcd(), usb_phy_roothub_alloc() can return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Signed-off-by: Zhang Shengju Signed-off-by: Tang Bin --- drivers/usb/core/hcd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index aa45840d8..b73a92ee1 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2633,8 +2633,9 @@ int usb_add_hcd(struct usb_hcd *hcd, if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); - if (IS_ERR(hcd->phy_roothub)) - return PTR_ERR(hcd->phy_roothub); + if (IS_ERR_OR_NULL(hcd->phy_roothub)) + return hcd->phy_roothub ? + PTR_ERR(hcd->phy_roothub) : -ENODEV; retval = usb_phy_roothub_init(hcd->phy_roothub); if (retval) -- 2.20.1.windows.1