From patchwork Tue Feb 8 20:32:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12739459 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 4B0FDC433F5 for ; Tue, 8 Feb 2022 22:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241960AbiBHWYM (ORCPT ); Tue, 8 Feb 2022 17:24:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386435AbiBHUcg (ORCPT ); Tue, 8 Feb 2022 15:32:36 -0500 Received: from mxout04.lancloud.ru (mxout04.lancloud.ru [45.84.86.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8786DC0613CB for ; Tue, 8 Feb 2022 12:32:32 -0800 (PST) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 5845020AD36D Received: from LanCloud Received: from LanCloud Received: from LanCloud To: Peter Chen , Greg Kroah-Hartman , From: Sergey Shtylyov Subject: [PATCH] usb: common: usb-otg-fsm: drop unreachable code in otg_statemachine() Organization: Open Mobile Platform Message-ID: <5c923258-67c3-bae1-80d1-87a187202a4c@omp.ru> Date: Tue, 8 Feb 2022 23:32:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 Content-Language: en-US X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The *switch* statement in otg_statemachine() does handle all possible OTG states explicitly, so the *default* label is unreachable. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Signed-off-by: Sergey Shtylyov --- This patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo. Peter Chen's 'usb.git' repo seems outdated, so I chose to ignore it... drivers/usb/common/usb-otg-fsm.c | 2 -- 1 file changed, 2 deletions(-) Index: usb/drivers/usb/common/usb-otg-fsm.c =================================================================== --- usb.orig/drivers/usb/common/usb-otg-fsm.c +++ usb/drivers/usb/common/usb-otg-fsm.c @@ -440,8 +440,6 @@ int otg_statemachine(struct otg_fsm *fsm if (fsm->id || fsm->a_bus_drop || fsm->a_clr_err) otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); break; - default: - break; } mutex_unlock(&fsm->lock);