Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3635746ybi; Mon, 29 Jul 2019 09:53:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSudGIOQdd0mM0UdC8EEQynfbzdmvjkoBxdrQix4xhfTfBsyv/BwYsISLxwHWmxB0g8gas X-Received: by 2002:a63:a35e:: with SMTP id v30mr45484931pgn.129.1564419221402; Mon, 29 Jul 2019 09:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564419221; cv=none; d=google.com; s=arc-20160816; b=L/bBNySIam8FT69c5hKXCSzjU1tW2g1xp9XBJ6fztW9j3csrxhWPmCbgRzqPpCwJuI joRVtTonEQGq2pgIC5u0UFiP5v2aSD6Nm4/3bpY1Y1Uk00lzYk6gLnrbImBCN9nCsBHL mc19FlHtpUiDVnmTKdiqDee0C5N2XHyx6nrgsDveU1IbJAXKddO2AIfDrjOTMqCeFGzy hMlDp+2L3J4tbLIafe68z1dL3Oae5mfYPJhlu7ojaBFU1mBV7mBRode5UUrTwC1o5Ut7 iXFyrOSSkRQJRKKuWQyH+vJ1bELDnOLM+a/dXiLxteix9/iCIudKEBNsvmt2OgvFEW50 nL7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mdTXOfOovTlwSda3O/fFZhQvp67cV9yb0CIwUeXn1RI=; b=Y9x5QYa5tANFGNI67BPAeNZM6AAXb5XeYy23Lw1PscDa8fP+Jp7DMXB2yhQsFd+8hc OJApSIvfgtIGYqt1/9QV96WfxHI8FRPm29lfphdavFbgdvwWuwkCZtybjz9wuMkTbMWB B8OZrJCaxJqc+RpBZBpGZsWyP9T1cBHI3c0pOnNdKOcjj/dckM4vy1DX6izydwia0+0q ib2zQO0nBtR61hpCXnXVfJPcj0Y3clBtaqAs5XsznOlZ12baFDHrtg4lTSvI2Fc6GRSK nlk5/1YLPPjJ0g1vBEyiRxg3n4Eq7INK3NXu2lMtXavOWeJa7COlHXiQJpOWbMMiAK32 VTtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mbozBovk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si25181741plm.295.2019.07.29.09.53.26; Mon, 29 Jul 2019 09:53:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mbozBovk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387681AbfG2Qgo (ORCPT + 99 others); Mon, 29 Jul 2019 12:36:44 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35620 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387402AbfG2Qgo (ORCPT ); Mon, 29 Jul 2019 12:36:44 -0400 Received: by mail-pf1-f193.google.com with SMTP id u14so28330182pfn.2 for ; Mon, 29 Jul 2019 09:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mdTXOfOovTlwSda3O/fFZhQvp67cV9yb0CIwUeXn1RI=; b=mbozBovkfIRC7KNEazYHxHu01ZoXIL0Td88QY3+N6rKBFGzZtbLhA90H8M40LuAgMM ZmxMzySYaivWafsimcD6zJRJyVWPpmu4AFUYLBNqyrEwAez+9j1Uh+EHuoZvRC7eaD/y FjXj19LO1WfiIS+5RTmoHCzxPc6FI+nkeOz6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mdTXOfOovTlwSda3O/fFZhQvp67cV9yb0CIwUeXn1RI=; b=HvE0SNJ2GXbqjeRUlH0h+8YpGbYlGMPC1NdvBflI8+QzPF4b9xxv3UQgWpJqi3Nf1E +DW0xcqn8+gYdruNVEPbfJWwvZlRh/Tx3xpgjEaVgpaV1w5astmtX9FH8WLUz76VafbY exdmF9sNQubovamTmPx8/tBRfhg72nVQ2Z6jfhvyOAPTD2htMlUmRPTtADZOr/E5JSGO 5oSlyWPE6iGgiQQ3QKy/Bd/02P57g0+7hfjHYxsovxa9rLUIgSZfV7rqrdqvD/Yw4n4C fQCy6wO44bfO58q9uHSzv5tLtCItg4nX0EFgpcUSWVacXlTisuYnBh0Y7W7pWG4dhGcj hKgg== X-Gm-Message-State: APjAAAWSbzi262Zo/pURbX7qzykCo3EkRe74P6cWOSUvSdr3+3SEZHbt b6JjmDXVy/z4Uqy729SrQ7Hppg== X-Received: by 2002:a63:9dcb:: with SMTP id i194mr59867132pgd.444.1564418203148; Mon, 29 Jul 2019 09:36:43 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l1sm81044255pfl.9.2019.07.29.09.36.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jul 2019 09:36:41 -0700 (PDT) Date: Mon, 29 Jul 2019 09:36:40 -0700 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Rothwell Subject: Re: [PATCH] usb: phy: ab8500-usb: Mark expected switch fall-throughs Message-ID: <201907290936.F5F486A6F@keescook> References: <20190729000631.GA24165@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190729000631.GA24165@embeddedor> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 28, 2019 at 07:06:31PM -0500, Gustavo A. R. Silva wrote: > Mark switch cases where we are expecting to fall through. > > This patch fixes the following warnings: > > drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8500_usb_link_status_update': > drivers/usb/phy/phy-ab8500-usb.c:424:9: warning: this statement may fall through [-Wimplicit-fallthrough=] > event = UX500_MUSB_RIDB; > ~~~~~~^~~~~~~~~~~~~~~~~ > drivers/usb/phy/phy-ab8500-usb.c:425:2: note: here > case USB_LINK_NOT_CONFIGURED_8500: > ^~~~ > drivers/usb/phy/phy-ab8500-usb.c:440:9: warning: this statement may fall through [-Wimplicit-fallthrough=] > event = UX500_MUSB_RIDC; > ~~~~~~^~~~~~~~~~~~~~~~~ > drivers/usb/phy/phy-ab8500-usb.c:441:2: note: here > case USB_LINK_STD_HOST_NC_8500: > ^~~~ > drivers/usb/phy/phy-ab8500-usb.c:459:9: warning: this statement may fall through [-Wimplicit-fallthrough=] > event = UX500_MUSB_RIDA; > ~~~~~~^~~~~~~~~~~~~~~~~ > drivers/usb/phy/phy-ab8500-usb.c:460:2: note: here > case USB_LINK_HM_IDGND_8500: > ^~~~ > drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8505_usb_link_status_update': > drivers/usb/phy/phy-ab8500-usb.c:332:9: warning: this statement may fall through [-Wimplicit-fallthrough=] > event = UX500_MUSB_RIDB; > ~~~~~~^~~~~~~~~~~~~~~~~ > drivers/usb/phy/phy-ab8500-usb.c:333:2: note: here > case USB_LINK_NOT_CONFIGURED_8505: > ^~~~ > drivers/usb/phy/phy-ab8500-usb.c:352:9: warning: this statement may fall through [-Wimplicit-fallthrough=] > event = UX500_MUSB_RIDC; > ~~~~~~^~~~~~~~~~~~~~~~~ > drivers/usb/phy/phy-ab8500-usb.c:353:2: note: here > case USB_LINK_STD_HOST_NC_8505: > ^~~~ > drivers/usb/phy/phy-ab8500-usb.c:370:9: warning: this statement may fall through [-Wimplicit-fallthrough=] > event = UX500_MUSB_RIDA; > ~~~~~~^~~~~~~~~~~~~~~~~ > drivers/usb/phy/phy-ab8500-usb.c:371:2: note: here > case USB_LINK_HM_IDGND_8505: > ^~~~ > > Reported-by: Stephen Rothwell > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -Kees > --- > drivers/usb/phy/phy-ab8500-usb.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c > index aaf363f19714..14b432982fd3 100644 > --- a/drivers/usb/phy/phy-ab8500-usb.c > +++ b/drivers/usb/phy/phy-ab8500-usb.c > @@ -330,6 +330,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, > switch (lsts) { > case USB_LINK_ACA_RID_B_8505: > event = UX500_MUSB_RIDB; > + /* Fall through */ > case USB_LINK_NOT_CONFIGURED_8505: > case USB_LINK_RESERVED0_8505: > case USB_LINK_RESERVED1_8505: > @@ -350,6 +351,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, > > case USB_LINK_ACA_RID_C_NM_8505: > event = UX500_MUSB_RIDC; > + /* Fall through */ > case USB_LINK_STD_HOST_NC_8505: > case USB_LINK_STD_HOST_C_NS_8505: > case USB_LINK_STD_HOST_C_S_8505: > @@ -368,6 +370,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, > case USB_LINK_ACA_RID_A_8505: > case USB_LINK_ACA_DOCK_CHGR_8505: > event = UX500_MUSB_RIDA; > + /* Fall through */ > case USB_LINK_HM_IDGND_8505: > if (ab->mode == USB_IDLE) { > ab->mode = USB_HOST; > @@ -422,6 +425,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab, > switch (lsts) { > case USB_LINK_ACA_RID_B_8500: > event = UX500_MUSB_RIDB; > + /* Fall through */ > case USB_LINK_NOT_CONFIGURED_8500: > case USB_LINK_NOT_VALID_LINK_8500: > ab->mode = USB_IDLE; > @@ -438,6 +442,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab, > case USB_LINK_ACA_RID_C_HS_8500: > case USB_LINK_ACA_RID_C_HS_CHIRP_8500: > event = UX500_MUSB_RIDC; > + /* Fall through */ > case USB_LINK_STD_HOST_NC_8500: > case USB_LINK_STD_HOST_C_NS_8500: > case USB_LINK_STD_HOST_C_S_8500: > @@ -457,6 +462,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab, > > case USB_LINK_ACA_RID_A_8500: > event = UX500_MUSB_RIDA; > + /* Fall through */ > case USB_LINK_HM_IDGND_8500: > if (ab->mode == USB_IDLE) { > ab->mode = USB_HOST; > -- > 2.22.0 > -- Kees Cook