Re: [PATCH v4 1/9] driver core: add a faux bus for use when a simple device/bus is needed

Zijun Hu
2025-02-11T15:29:15Z

On 2025/2/10 22:29, Kurt Borja wrote:
>> +
>> + ret = device_add(dev);
>> + if (ret) {
>> + pr_err("%s: device_add for faux device '%s' failed with %d\n",
>> + __func__, name, ret);
>> + put_device(dev);
>> + return NULL;
>> + }
> Now that the probe is synchronous, what do you think about returning
> -ENODEV if the device failed to bind to the driver?
>

Result of device registering @ret is not, should not be, effected by
"device binding driver (probe result)"

if device binging driver failed, you may return -ENODEV in
faux_ops->probe(). not here.

> This would be useful for modules that may want to unload if the probe
> fails.

may need to root cause if probe failure happens.

how to unload module automatically if probe() failure ?