Thread (2 messages) flat view 2 messages, 1 author, 8d ago

Re: [PATCH net-next RFT] ch9200: return error on failed register writes in ch9200_bind()

From: Sergey Shtylyov <hidden>
Date: 2026-09-08 19:52:49
Also in: linux-usb

On 9/3/26 11:18 PM, Sergey Shtylyov wrote:
The successful register writes, done via the USB control requests in
control_write(), seem vital for the normal functioning of the device,
however the driver's bind() method ignores error codes returned from
control_write().  Do bail out of ch9200_bind() on failed writes...

Found by Linux Verification Center (linuxtesting.org) with the Svace
static analysis tool.

Signed-off-by: Sergey Shtylyov <redacted>
   Scratch this patch, I was sloppy... :-)

[...]
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c
index a206ffa76f1b..ce2e62f85c3d 100644
--- a/drivers/net/usb/ch9200.c
+++ b/drivers/net/usb/ch9200.c
@@ -360,32 +360,44 @@ static int ch9200_bind(struct usbnet *dev, struct usb_interface *intf)
 	data[1] = 0x0F;
 	retval = control_write(dev, REQUEST_WRITE, 0, MAC_REG_THRESHOLD, data,
 			       0x02, CONTROL_TIMEOUT_MS);
+	if (retval)
   Should be (retval < 0) here an below, as Sashiko pointed out.

[...]

MBR, Sergey
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help