Skip to content

Conversation

@mhennerich
Copy link
Contributor

PR Description

Further testing with overlays triggering deferred probe returns exhibited some more problems....

The embedded struct device in jesd204_dev was not properly managed across driver bind/unbind cycles, causing several issues:

  1. Missing release function: The kernel requires every struct device to have a release() function. Without one, put_device() triggers a WARNING ("does not have a release() function, it is broken"). Add a jesd204_dev_type with a no-op release callback, since the jdev memory is managed separately by the jesd204 core.

  2. Missing put_device() calls: device_del() must be paired with put_device() to drop the reference taken by device_initialize(). Add the missing put_device() in both jesd204_dev_unregister() and the err_device_del error path in jesd204_dev_register().

  3. Stale device state on re-probe: After a driver unbinds, jesd204_dev_unregister() must fully reset the embedded struct device via memset so that a subsequent probe can safely call device_initialize() + device_add() again with the same device name. Without the memset, the kobject retains its initialized state, triggering "tried to init an initialized object" warnings on re-probe. Move the memset into the dev.parent conditional block alongside device_del/put_device where it logically belongs.

  4. Stale unregistered flag: When a driver probe fails after successful jesd204_dev_register(), the devm cleanup sets jdev->unregistered to true. On deferred probe retry, this flag was never cleared, which would cause a subsequent unregister to skip cleanup. Reset the flag at the start of jesd204_dev_register().

PR Type

  • Bug fix (a change that fixes an issue)
…cles

The embedded struct device in jesd204_dev was not properly managed
across driver bind/unbind cycles, causing several issues:

1. Missing release function: The kernel requires every struct device to
   have a release() function. Without one, put_device() triggers a
   WARNING ("does not have a release() function, it is broken"). Add a
   jesd204_dev_type with a no-op release callback, since the jdev
   memory is managed separately by the jesd204 core.

2. Missing put_device() calls: device_del() must be paired with
   put_device() to drop the reference taken by device_initialize().
   Add the missing put_device() in both jesd204_dev_unregister() and
   the err_device_del error path in jesd204_dev_register().

3. Stale device state on re-probe: After a driver unbinds,
   jesd204_dev_unregister() must fully reset the embedded struct device
   via memset so that a subsequent probe can safely call
   device_initialize() + device_add() again with the same device name.
   Without the memset, the kobject retains its initialized state,
   triggering "tried to init an initialized object" warnings on
   re-probe. Move the memset into the dev.parent conditional block
   alongside device_del/put_device where it logically belongs.

4. Stale unregistered flag: When a driver probe fails after successful
   jesd204_dev_register(), the devm cleanup sets jdev->unregistered to
   true. On deferred probe retry, this flag was never cleared, which
   would cause a subsequent unregister to skip cleanup. Reset the flag
   at the start of jesd204_dev_register().


Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
@mhennerich mhennerich force-pushed the staging/xlnx/jesd204-fsm-dtoverlay-fixes branch from fd192e5 to 627d249 Compare January 29, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants