Re: [PATCH] usb: rtl8150: avoid using uninitialized CSCR value

Andrew Lunn
2026-04-05T23:38:24Z

> > - get_registers(dev, CSCR, 2, &tmp);
> > + if (get_registers(dev, CSCR, 2, &tmp) < 0)
> > + tmp = 0;
> > if (tmp & CSCR_LINK_STATUS)
> > netif_carrier_on(netdev);
> > else
>
> I was wondering if calling netif_carrier_off() is the right thing to do in case
> get_registers() fail.
>
> There are multiple get_registers() calls that don't check the error and if we do
> this in set_carrier() maybe we should do the same thing across the whole driver?

What does it actually mean if get_registers() fails? The device is
gone? Hot unplugged? If so, you are going to get a cascade of errors,
and then hopefully the USB core code removes the device?

Are there any legitimate reasons for get_registers() to fail if the
device is still plugged in?

It seems netif_carrier_off() is unnecessary?

Andrew