Re: [PATCH v3] drivers/base: return bus_add_driver() errors
From: Yemingxuan
Date: Tue Oct 20 2026 - 03:26:52 EST
Hi Greg,
Thanks for the review.
> Full name?
My full name is Ye Mingxuan; I had it in the From: line as a single
latinised word. I will use the full form from now on.
> Are you sure that this is going to work properly? How was this tested?
You're right to ask. It has not been tested at runtime, only built and
checked with checkpatch. I looked at the three failure modes again and
that is where the real problem is:
- -EINVAL is unreachable: driver_ktype always supplies sysfs_ops, so
sysfs_add_file_mode_ns() can never reject the attribute on that
ground.
- -EEXIST needs an in-tree bus whose drv_groups collides with the
built-in uevent, bind or unbind attribute. None of the eight buses
that define drv_groups do.
- -ENOMEM would need an allocation failure at exactly that point in
boot.
So there is no way for me to construct the situation this patch is
supposed to handle, which also means I cannot show that the unwind is
correct.
> That comment is a good indication that no one will hit this, so why
> even worry about any of this?
Agreed. I read that comment as "the author gave up on the error path",
but you are right that it says more about how reachable the path is than
about whether it is handled. With -EINVAL and -EEXIST both ruled out and
-ENOMEM being a boot-time allocation failure, changing the error handling
here buys nothing that anyone can observe, and it does add a return path
that was never exercised.
Please drop this patch. Sorry for the noise.
Ye Mingxuan