Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: i2c: mt9p031: fix mbus code initialization

The mediabus code is device dependent, but the probe() function
thought that device_get_match_data() would return the code directly,
when in fact it returned a pointer to a struct mt9p031_model_info.

As a result, the initial mbus code was garbage.

Tested with a BeagleBoard xM and a Leopard Imaging LI-5M03 sensor board.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Tested-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Fixes: a80b1bbff88b ("media: mt9p031: Refactor format handling for different sensor models")
Cc: stable@vger.kernel.org

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
075710b6 4010eef0

+3 -1
+3 -1
drivers/media/i2c/mt9p031.c
··· 1093 1093 static int mt9p031_probe(struct i2c_client *client) 1094 1094 { 1095 1095 struct i2c_adapter *adapter = client->adapter; 1096 + const struct mt9p031_model_info *info; 1096 1097 struct mt9p031 *mt9p031; 1097 1098 unsigned int i; 1098 1099 int ret; ··· 1114 1113 1115 1114 mt9p031->output_control = MT9P031_OUTPUT_CONTROL_DEF; 1116 1115 mt9p031->mode2 = MT9P031_READ_MODE_2_ROW_BLC; 1117 - mt9p031->code = (uintptr_t)device_get_match_data(&client->dev); 1116 + info = device_get_match_data(&client->dev); 1117 + mt9p031->code = info->code; 1118 1118 1119 1119 mt9p031->regulators[0].supply = "vdd"; 1120 1120 mt9p031->regulators[1].supply = "vdd_io";