linux-stable/drivers/usb/cdns3
Nathan Chancellor 78acd4ca43 usb: cdns3: Don't use priv_dev uninitialized in cdns3_gadget_ep_enable()
Clang warns:

  drivers/usb/cdns3/cdns3-gadget.c:2290:11: error: variable 'priv_dev' is uninitialized when used here [-Werror,-Wuninitialized]
                  dev_dbg(priv_dev->dev, "usbss: invalid parameters\n");
                          ^~~~~~~~
  include/linux/dev_printk.h:155:18: note: expanded from macro 'dev_dbg'
          dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                          ^~~
  include/linux/dynamic_debug.h:167:7: note: expanded from macro 'dynamic_dev_dbg'
                          dev, fmt, ##__VA_ARGS__)
                          ^~~
  include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic_func_call'
          __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
                                                              ^~~~~~~~~~~
  include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynamic_func_call'
                  func(&id, ##__VA_ARGS__);               \
                              ^~~~~~~~~~~
  drivers/usb/cdns3/cdns3-gadget.c:2278:31: note: initialize the variable 'priv_dev' to silence this warning
          struct cdns3_device *priv_dev;
                                      ^
                                      = NULL
  1 error generated.

The priv_dev assignment was moved below the if statement to avoid
potentially dereferencing ep before it was checked but priv_dev is used
in the dev_dbg() call.

To fix this, move the priv_dev and comp_desc assignments back to their
original spot and hoist the ep check above those assignments with a call
to pr_debug() instead of dev_dbg().

Fixes: c3ffc9c4ca ("usb: cdns3: change place of 'priv_ep' assignment in cdns3_gadget_ep_dequeue(), cdns3_gadget_ep_enable()")
Link: https://github.com/ClangBuiltLinux/linux/issues/1680
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-08-04 11:53:48 -07:00
..
cdns3-debug.h usb: cdns3: Change file names for cdns3 driver. 2020-12-29 12:36:13 +08:00
cdns3-ep0.c usb: cdns3: Fixed incorrect gadget state 2021-07-29 14:13:02 +08:00
cdns3-gadget.c usb: cdns3: Don't use priv_dev uninitialized in cdns3_gadget_ep_enable() 2022-08-04 11:53:48 -07:00
cdns3-gadget.h usb: cdns3: allocate TX FIFO size according to composite EP number 2022-05-19 18:14:29 +02:00
cdns3-imx.c usb: cdns3: cdns3-imx: File headers are not good candidates for kernel-doc 2021-05-27 09:43:44 +02:00
cdns3-pci-wrap.c usb: cdns3: fix spelling mistake "wrapperr" -> "wrapper" 2020-03-19 15:14:48 +01:00
cdns3-plat.c usb: cdns3: Use platform_get_irq_byname() to get the interrupt 2021-12-21 08:51:57 +01:00
cdns3-ti.c usb: cdns3: cdns3-ti: File headers are not good candidates for kernel-doc 2021-05-27 09:43:44 +02:00
cdns3-trace.c usb: cdns3: Change file names for cdns3 driver. 2020-12-29 12:36:13 +08:00
cdns3-trace.h usb: cdns3: trace: delete the trace parameter for request->trb 2021-04-12 20:19:21 +08:00
cdnsp-debug.h usb: cdnsp: fix cdnsp_decode_trb function to properly handle ret value 2022-01-26 13:59:20 +01:00
cdnsp-ep0.c usb: cdnsp: Removes some useless trace events 2021-02-06 15:43:52 +08:00
cdnsp-gadget.c usb: cdnsp: remove not used temp_64 variables 2022-01-26 13:59:23 +01:00
cdnsp-gadget.h usb: cdnsp: Fix the IMAN_IE_SET and IMAN_IE_CLEAR macro 2021-07-29 14:28:15 +08:00
cdnsp-mem.c usb: cdnsp: Fix a NULL pointer dereference in cdnsp_endpoint_init() 2021-12-03 13:57:45 +01:00
cdnsp-pci.c usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver 2020-12-29 12:36:13 +08:00
cdnsp-ring.c usb: cdnsp: Fixed setting last_trb incorrectly 2022-06-10 11:15:23 +02:00
cdnsp-trace.c usb: cdnsp: Add tracepoints for CDNSP driver 2020-12-29 12:36:13 +08:00
cdnsp-trace.h usb: cdnsp: Fix issue in cdnsp_log_ep trace event 2021-12-13 15:23:24 +01:00
core.c usb: cdns3: core: Fix a couple of incorrectly documented function names 2021-05-27 09:43:44 +02:00
core.h headers/prep: Fix non-standard header section: drivers/usb/cdns3/core.h 2022-01-05 16:17:31 +01:00
drd.c usb: cdnsp: Fix segmentation fault in cdns_lost_power function 2022-01-26 14:11:16 +01:00
drd.h usb: cdns3: add power lost support for system resume 2021-04-12 20:19:20 +08:00
gadget-export.h usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver 2020-12-29 12:36:13 +08:00
host-export.h usb: cdns3: Removes xhci_cdns3_suspend_quirk from host-export.h 2020-12-29 12:36:13 +08:00
host.c treewide: Add missing includes masked by cgroup -> bpf dependency 2021-12-03 10:58:13 -08:00
Kconfig usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver 2020-12-29 12:36:13 +08:00
Makefile usb: cdnsp: fixes undefined reference to cdns_remove 2021-01-14 09:02:00 +08:00