mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
78acd4ca43
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:
|
||
---|---|---|
.. | ||
cdns3-debug.h | ||
cdns3-ep0.c | ||
cdns3-gadget.c | ||
cdns3-gadget.h | ||
cdns3-imx.c | ||
cdns3-pci-wrap.c | ||
cdns3-plat.c | ||
cdns3-ti.c | ||
cdns3-trace.c | ||
cdns3-trace.h | ||
cdnsp-debug.h | ||
cdnsp-ep0.c | ||
cdnsp-gadget.c | ||
cdnsp-gadget.h | ||
cdnsp-mem.c | ||
cdnsp-pci.c | ||
cdnsp-ring.c | ||
cdnsp-trace.c | ||
cdnsp-trace.h | ||
core.c | ||
core.h | ||
drd.c | ||
drd.h | ||
gadget-export.h | ||
host-export.h | ||
host.c | ||
Kconfig | ||
Makefile |