Device match data and DT compatible string fallback

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

 



Hello,

I recently ran into an issue in a driver (drivers/iio/dac/ti-dac5571.c
to be precise, but the problem is more generic) that led to a crash at
probe time. The driver supports matching to both OF devices and platform
devices by specifying of_device_id and i2c_device_id tables. It supports
multiple devices, and stores device-specific data in the i2c_device_id
table that it retrieves at probe time through the i2c_device_id pointer
passed to the probe function.

The device I'm working with is an DAC081C081, which is compatible with
the DAC5571. It's an OF device that has the compatible property set to

	compatible = "ti,dac081c081", "ti,dac5571";

The driver doesn't support the ti,dac081c081 compatible string, so the
device is matched to the driver using the compatible fallback
"ti,dac5571". This leads to the i2c_device_id passed to the proble
function being NULL, as the i2c_device_if table doesn't contain a
"dac5571" entry, and this results in a crash.

I could fix this in the driver by calling of_device_get_match_data() in
the probe function with dev->of_node is not NULL, but I feel this is
really an issue that should be handled by the framework. Has anyone ever
given it a thought ?

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux