Probe

2 Posts

Why Linux Driver probe Failure Paths Are More Bug-Prone Than Successful probe

7 minute

Driver debugging often focuses on the successful probe path: acquire resources, map registers, request interrupt, initialize hardware, register user-space interface, then print “probe ok”.

Field bugs often hide on another path:

  • probe fails halfway and does not roll back cleanly
  • probe returns an error while IRQ or workqueue is still active
  • user space keeps an fd after remove
  • runtime suspend is powering down while the error path releases resources
  • DMA buffer is freed while the device is still writing
  • devm_ is used, but object lifetime is not what the driver expected

The hard part is not initializing hardware once. The hard part is: if any step fails, the device is removed, the module unloads, the system suspends, or user space still holds an fd, the driver must stop everything it has already started in the right order.

Read More

Why platform driver probe Happens

8 minute

platform_driver is common in embedded Linux. SoC internal peripherals such as UART, I2C controllers, SPI controllers, PWM, watchdogs, GPIO controllers, clock controllers, and interrupt controllers often use platform drivers.

When debugging this kind of driver, the most common problem is not a wrong register write. It is that probe never happens.

The Device Tree node exists, and the driver is built in, but why does probe not run?
The compatible string looks right, but why does it not match?
probe runs, but why are resources missing?
What does EPROBE_DEFER in the log mean?

Read More