Skip to contentSkip to conversation

usb: xhci: Initialize unassigned variables to fix possible errors

PATCH In review Selvarasu Ganesan 2 participants 2 messages Feb 10, 2025 – Feb 11, 2025 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20250210131144epcas5p4a0599050f5973b495db0371021c21e27@epcas5p4.samsung.com

#1 lore raw

PATCH 1/1 usb: xhci: Initialize unassigned variables to fix possible errors

Fix the following smatch errors:

drivers/usb/host/xhci-mem.c:2060 xhci_add_in_port() error: unassigned variable 'tmp_minor_revision' drivers/usb/host/xhci-hub.c:71 xhci_create_usb3x_bos_desc() error: unassigned variable 'bcdUSB'

Fixes d9b0328d0b8b ("xhci: Show ZHAOXIN xHCI root hub speed correctly")
Fixes eb02aaf21f29 ("usb: xhci: Rewrite xhci_create_usb3_bos_desc()")
---
 drivers/usb/host/xhci-hub.c | 2 +-
 drivers/usb/host/xhci-mem.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-hub.c +1 -1
index 9693464c0520..5715a8bdda7f 100644
@@ -39,7 +39,7 @@ static int xhci_create_usb3x_bos_desc(struct xhci_hcd *xhci, char *buf,
 	struct usb_ss_cap_descriptor	*ss_cap;
 	struct usb_ssp_cap_descriptor	*ssp_cap;
 	struct xhci_port_cap		*port_cap = NULL;
-	u16				bcdUSB;
+	u16				bcdUSB = 0;
 	u32				reg;
 	u32				min_rate = 0;
 	u8				min_ssid;
drivers/usb/host/xhci-mem.c +1 -1
index 92703efda1f7..8665893df894 100644
@@ -1980,7 +1980,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 {
 	u32 temp, port_offset, port_count;
 	int i;
-	u8 major_revision, minor_revision, tmp_minor_revision;
+	u8 major_revision, minor_revision, tmp_minor_revision = 0;
 	struct xhci_hub *rhub;
 	struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
 	struct xhci_port_cap *port_cap;
Signature · 1 line
2.17.1
maintainer
#2 lore raw
Quoted 7 lines · Selvarasu Ganesan

Fix the following smatch errors:

drivers/usb/host/xhci-mem.c:2060 xhci_add_in_port() error: unassigned variable 'tmp_minor_revision' drivers/usb/host/xhci-hub.c:71 xhci_create_usb3x_bos_desc() error: unassigned variable 'bcdUSB'

Fixes d9b0328d0b8b ("xhci: Show ZHAOXIN xHCI root hub speed correctly")
Fixes eb02aaf21f29 ("usb: xhci: Rewrite xhci_create_usb3_bos_desc()")

This should be two different changes, right?

Please break it up and send as a patch series.

thanks,

greg k-h