Re: [PATCH v2] usb: misc: uss720: properly clean up reference in uss720_probe()
From: Oliver Neukum
Date: Mon Feb 23 2026 - 07:56:26 EST
On 23.02.26 13:14, Greg Kroah-Hartman wrote:
It's tricky stuff like this which makes me can't wait for rust to be
possible for USB drivers, someday...
Well, as you wish to touch upon that topic ...
I am afraid this is not a problem of language. Rust
solves the issue of object life time. Unfortunately
that is useless in this case. I know we all wish
to solve the issue, but let me explain.
Now, before you either start despairing or get angry, we
need to look at concepts. It seems to my you're looking at
the problem in terms of life time and basically
something that can be solved by reference counting
respectively life time rules.
That is unfortunately not true. Our problem with USB
drivers is a question of binding. probe() does not mean
that a device has been plugged in, nor does disconnect()
mean that a device has gone away. It means that the binding
between an interface and a driver is requested respectively
goes away. Hotplug is merely the most common cause of
these requests.
Nevertheless you have to cease using the interface as
disconnect() is called. References cannot change that.
There are two reasons for that
a) there is no object representing the binding. It is technically
a pointer not a data structure. There is nothing to refcount
and no object whose lifetime you can specify. There is a variable
that is changing
b) there is a state transition, not a life time question.
There is an event that changes the state of a binding if you
will.
Sorry you don't like this, but this is a design issue, not
a language issue.
Regards
Oliver