From patchwork Tue Feb 25 13:08:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 11403713 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E795714E3 for ; Tue, 25 Feb 2020 13:09:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0EF520CC7 for ; Tue, 25 Feb 2020 13:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729853AbgBYNJo (ORCPT ); Tue, 25 Feb 2020 08:09:44 -0500 Received: from smtp1.de.adit-jv.com ([93.241.18.167]:50832 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729179AbgBYNJo (ORCPT ); Tue, 25 Feb 2020 08:09:44 -0500 Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id EE9543C0579; Tue, 25 Feb 2020 14:09:40 +0100 (CET) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oALL3uPy91rv; Tue, 25 Feb 2020 14:09:32 +0100 (CET) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id C24EA3C005E; Tue, 25 Feb 2020 14:09:32 +0100 (CET) Received: from lxhi-065.adit-jv.com (10.72.93.66) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.468.0; Tue, 25 Feb 2020 14:09:32 +0100 From: Eugeniu Rosca To: , , CC: Alan Stern , Greg Kroah-Hartman , Thinh Nguyen , "Lee, Chiasheng" , Mathieu Malaterre , Kai-Heng Feng , Eugeniu Rosca , Hardik Gajjar , Subject: [PATCH] usb: hub: Fix unhandled return value of usb_autopm_get_interface() Date: Tue, 25 Feb 2020 14:08:46 +0100 Message-ID: <20200225130846.20236-1-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-Originating-IP: [10.72.93.66] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Address below Coverity complaint (Feb 25, 2020, 8:06 AM CET): *** CID 1458999: Error handling issues (CHECKED_RETURN) /drivers/usb/core/hub.c: 1869 in hub_probe() 1863 1864 if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND) 1865 hub->quirk_check_port_auto_suspend = 1; 1866 1867 if (id->driver_info & HUB_QUIRK_DISABLE_AUTOSUSPEND) { 1868 hub->quirk_disable_autosuspend = 1; >>> CID 1458999: Error handling issues (CHECKED_RETURN) >>> Calling "usb_autopm_get_interface" without checking return value (as is done elsewhere 97 out of 111 times). 1869 usb_autopm_get_interface(intf); 1870 } 1871 1872 if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) 1873 return 0; 1874 Fixes: 1208f9e1d758c9 ("USB: hub: Fix the broken detection of USB3 device in SMSC hub") Cc: Hardik Gajjar Cc: Alan Stern Cc: Greg Kroah-Hartman Reported-by: scan-admin@coverity.com Signed-off-by: Eugeniu Rosca --- drivers/usb/core/hub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1d212f82c69b..ff04ca28970d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1865,8 +1865,12 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) hub->quirk_check_port_auto_suspend = 1; if (id->driver_info & HUB_QUIRK_DISABLE_AUTOSUSPEND) { - hub->quirk_disable_autosuspend = 1; - usb_autopm_get_interface(intf); + int r = usb_autopm_get_interface(intf); + + if (!r) + hub->quirk_disable_autosuspend = 1; + else + dev_dbg(&intf->dev, "disable autosuspend err=%d\n", r); } if (hub_configure(hub, &desc->endpoint[0].desc) >= 0)