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 96BC3C05027 for ; Tue, 14 Mar 2023 17:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230374AbjCNRIy (ORCPT ); Tue, 14 Mar 2023 13:08:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbjCNRIv (ORCPT ); Tue, 14 Mar 2023 13:08:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17D54C34; Tue, 14 Mar 2023 10:08:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1CA1CB81A59; Tue, 14 Mar 2023 17:08:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BF92C433D2; Tue, 14 Mar 2023 17:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678813726; bh=JNIQSdUCIjiAkwlMaJ5Xo54AjCtVj7uDpQv8Jko/3v8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zRW/YC8Hqi6/kG16phZuWE2YXQbfFss98KwxlWkloeanfPbQtndD7JFdYWnvyZoyK 5wTB5y0nYdzjy4mUAr9Eqg7vKTGbu9xTLukuFqqrHbGmq5rixupxtnE0WRbNYfUTaZ +kAN6o1d5anD5UyWckK+TEEMYo3pQImNR8Ky+GFQ= Date: Tue, 14 Mar 2023 18:08:44 +0100 From: Greg Kroah-Hartman To: Danila Chernetsov Cc: stable@vger.kernel.org, Bin Liu , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Sergey Shtylyov Subject: Re: [PATCH 5.10 1/1] usb: musb: core: drop redundant checks Message-ID: References: <20230314170113.11968-1-listdansp@mail.ru> <20230314170113.11968-2-listdansp@mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230314170113.11968-2-listdansp@mail.ru> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 14, 2023 at 05:01:13PM +0000, Danila Chernetsov wrote: > From: Sergey Shtylyov > > commit b0ec7e55fce65f125bd1d7f02e2dc4de62abee34 upstream. Nit, trailing whitespace, please fix your editor to show this up easier. > > In musb_{save|restore}_context() the expression '&musb->endpoints[i]' just > cannot be NULL, so the checks have no sense at all -- after dropping them, > the local variables 'hw_ep' are no longer necessary, so drop them as well. > > Found by Linux Verification Center (linuxtesting.org) with the SVACE static > analysis tool. > > Signed-off-by: Sergey Shtylyov > Link: https://lore.kernel.org/r/3f8f60d9-f1b5-6b2c-1222-39b156151a22@omp.ru > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Danila Chernetsov > --- > drivers/usb/musb/musb_core.c | 16 ++-------------- > 1 file changed, 2 insertions(+), 14 deletions(-) > > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > index 4c8f0112481f..605f5cc0f18b 100644 > --- a/drivers/usb/musb/musb_core.c > +++ b/drivers/usb/musb/musb_core.c > @@ -2673,13 +2673,7 @@ static void musb_save_context(struct musb *musb) > musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); > > for (i = 0; i < musb->config->num_eps; ++i) { > - struct musb_hw_ep *hw_ep; > - > - hw_ep = &musb->endpoints[i]; > - if (!hw_ep) > - continue; > - > - epio = hw_ep->regs; > + epio = musb->endpoints[i].regs; Why is this needed in the stable releases? It just seems to remove unused code, but does not change any logic at all, so why backport it? thanks, greg k-h