From: Rui Miguel Silva <rui.silva@linaro.org> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Alan Stern <stern@rowland.harvard.edu> Cc: linux-usb@vger.kernel.org, Rui Miguel Silva <rui.silva@linaro.org> Subject: [PATCH 5/5] usb: isp1760: clean never read udc_enabled warning Date: Thu, 19 Aug 2021 19:09:29 +0100 [thread overview] Message-ID: <20210819180929.1327349-6-rui.silva@linaro.org> (raw) In-Reply-To: <20210819180929.1327349-1-rui.silva@linaro.org> When CONFIG_USB_ISP1761_UDC is not enabled the udc_enabled variable is never used since it is short circuited before in the logic operations. This would trigger the following warning by clang analyzer: drivers/usb/isp1760/isp1760-core.c:490:2: warning: Value stored to 'udc_enabled' is never read [clang-analyzer-deadcode.DeadStores] udc_enabled = ((devflags & ISP1760_FLAG_ISP1763) || ^ drivers/usb/isp1760/isp1760-core.c:490:2: note: Value stored to 'udc_enabled' is never read Just swap the other of the operands in the logic operations. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> --- drivers/usb/isp1760/isp1760-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/isp1760/isp1760-core.c b/drivers/usb/isp1760/isp1760-core.c index ff07e2890692..cb70f9d63cdd 100644 --- a/drivers/usb/isp1760/isp1760-core.c +++ b/drivers/usb/isp1760/isp1760-core.c @@ -491,7 +491,7 @@ int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, (devflags & ISP1760_FLAG_ISP1761)); if ((!IS_ENABLED(CONFIG_USB_ISP1760_HCD) || usb_disabled()) && - (!IS_ENABLED(CONFIG_USB_ISP1761_UDC) || !udc_enabled)) + (!udc_enabled || !IS_ENABLED(CONFIG_USB_ISP1761_UDC))) return -ENODEV; isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL); @@ -571,7 +571,7 @@ int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, return ret; } - if (IS_ENABLED(CONFIG_USB_ISP1761_UDC) && udc_enabled) { + if (udc_enabled && IS_ENABLED(CONFIG_USB_ISP1761_UDC)) { ret = isp1760_udc_register(isp, irq, irqflags); if (ret < 0) { isp1760_hcd_unregister(hcd); -- 2.33.0
prev parent reply other threads:[~2021-08-19 18:09 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-19 18:09 [PATCH 0/5] usb: isp1760: clang analyzer fixes Rui Miguel Silva 2021-08-19 18:09 ` [PATCH 1/5] usb: isp1760: ignore return value for bus change pattern Rui Miguel Silva 2021-08-19 18:09 ` [PATCH 2/5] usb: isp1760: check maxpacketsize before using it Rui Miguel Silva 2021-08-19 18:09 ` [PATCH 3/5] usb: isp1760: do not reset retval Rui Miguel Silva 2021-08-19 18:09 ` [PATCH 4/5] usb: isp1760: do not shift in uninitialized slot Rui Miguel Silva 2021-08-19 18:09 ` Rui Miguel Silva [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210819180929.1327349-6-rui.silva@linaro.org \ --to=rui.silva@linaro.org \ --cc=gregkh@linuxfoundation.org \ --cc=linux-usb@vger.kernel.org \ --cc=stern@rowland.harvard.edu \ --subject='Re: [PATCH 5/5] usb: isp1760: clean never read udc_enabled warning' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).