ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [TECH TOPIC] Driver probe fails and register succeeds
@ 2022-06-23 23:05 Shuah Khan
  2022-06-23 23:13 ` Laurent Pinchart
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Shuah Khan @ 2022-06-23 23:05 UTC (permalink / raw)
  To: ksummit, ksummit; +Cc: Shuah Khan

I have been debugging a driver probe failure and noticed that driver gets
registered even when driver probe fails. This is not a new behavior. The
code in question is the same since 2005.

dmesg will say that a driver probe failed with error code and then the very
next message from interface core that says driver is registered successfully.
It will create sysfs interfaces.

The probe failure is propagated from the drive probe routine all the way up to
__driver_attach(). __driver_attach() ignores the error and and returns success.

         __device_driver_lock(dev, dev->parent);
         driver_probe_device(drv, dev);
         __device_driver_unlock(dev, dev->parent);

         return 0;

Interface driver register goes on to create sysfs entries as if driver probe
worked. It handles errors from driver_register() and unwinds the register
properly, however in this case it doesn't know about the failure.

At this point the driver is defunct with sysfs interfaces. User has to run
rmmod to get rid of the defunct driver.

Simply returning the error from __driver_attach() didn't work as expected.
I figured it would fail since not all interface drivers can handle errors
from driver probe routines.

I propose that we discuss the scenario to find possible solutions to avoid
defunct drivers.

thanks,
-- Shuah



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-06-24 15:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 23:05 [TECH TOPIC] Driver probe fails and register succeeds Shuah Khan
2022-06-23 23:13 ` Laurent Pinchart
2022-06-23 23:28   ` Shuah Khan
2022-06-23 23:30     ` Laurent Pinchart
2022-06-23 23:38       ` Shuah Khan
2022-06-23 23:57         ` Dan Williams
2022-06-24  1:00           ` Dmitry Torokhov
2022-06-24  6:33             ` Greg KH
2022-06-23 23:24 ` Guenter Roeck
2022-06-24  6:31 ` Greg KH
2022-06-24 15:55   ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).