Re: [PATCH] net: usb: net1080: add error handling to nc_vendor_write()
From: Andrew Lunn
Date: Mon Jul 27 2026 - 11:05:18 EST
On Mon, Jul 27, 2026 at 07:47:33PM +0530, Ashwin Gundarapu wrote:
> >From 70278069430a8b7d71728bc3c24400dc2bdffb63 Mon Sep 17 00:00:00 2001
> From: Ashwin Gundarapu <linuxuser509@xxxxxxxxxxx>
> Date: Mon, 27 Jul 2026 19:34:16 +0530
> Subject: [PATCH] net: usb: net1080: add error handling to nc_vendor_write()
>
> The nc_vendor_write() function currently ignores the return value of
> usbnet_write_cmd(). This can lead to silent failures when USB
> communication fails.
>
> Change nc_vendor_write() and nc_register_write() to return int
> instead of void, and propagate the error from usbnet_write_cmd()
> back to the caller.
The caller being:
static int net1080_reset(struct usbnet *dev)
{
u16 usbctl, status, ttl;
u16 vp;
int retval;
// nc_dump_registers(dev);
if ((retval = nc_register_read(dev, REG_STATUS, &vp)) < 0) {
netdev_dbg(dev->net, "can't read %s-%s status: %d\n",
dev->udev->bus->bus_name, dev->udev->devpath, retval);
goto done;
}
status = vp;
nc_dump_status(dev, status);
if ((retval = nc_register_read(dev, REG_USBCTL, &vp)) < 0) {
netdev_dbg(dev->net, "can't read USBCTL, %d\n", retval);
goto done;
}
usbctl = vp;
nc_dump_usbctl(dev, usbctl);
nc_register_write(dev, REG_USBCTL,
USBCTL_FLUSH_THIS | USBCTL_FLUSH_OTHER);
which just ignores the return value. How is this better?
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Andrew
---
pw-bot: cr