Re: [PATCH] usb-core: Set intfdata to NULL if a driver's probe method failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 22 May 2012, Hans de Goede wrote:

> Ensure that intfdata always is NULL if no driver is bound:
> 1) drvdata is for a driver to store a pointer to driver specific data
> 2) If no driver is bound, there is no driver specific data associated with
>    the device
> 3) Thus logically drvdata should be NULL if no driver is bound.

Rather: Thus logically, whatever is stored in drvdata is meaningless
while no driver is bound (i.e., it has meaning only to the driver and 
there is no driver).

> We already set intfdata to NULL when a driver is unbound, to ensure that
> intfdata will be NULL even if the drivers disconnect method does not properly
> clear it. This ensures that intfdata will also be NULL after a failed probe,
> even if the driver's probe method left a (likely dangling) pointer in there.
> 
> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
> ---
>  drivers/usb/core/driver.c |    1 +
>  1 file changed, 1 insertion(+)

Regardless, if you want to clear drvdata when no driver is bound, 
that's okay.  But this is not the right place to do it.  You should 
change the driver core, not just the USB subsystem.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux