]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: i2c: mt9p031: fix mbus code initialization
authorHans Verkuil <hverkuil+cisco@kernel.org>
Thu, 24 Apr 2025 09:27:30 +0000 (11:27 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 9 Sep 2025 13:59:16 +0000 (15:59 +0200)
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
drivers/media/i2c/mt9p031.c

index 4df8f2be15f3d7a7540529d42fcfd4c0faaf1e74..1500ee4db47ec7ddb2aa36c0f74ffd116726b3eb 100644 (file)
@@ -1093,6 +1093,7 @@ static int mt9p031_parse_properties(struct mt9p031 *mt9p031, struct device *dev)
 static int mt9p031_probe(struct i2c_client *client)
 {
        struct i2c_adapter *adapter = client->adapter;
+       const struct mt9p031_model_info *info;
        struct mt9p031 *mt9p031;
        unsigned int i;
        int ret;
@@ -1113,7 +1114,8 @@ static int mt9p031_probe(struct i2c_client *client)
 
        mt9p031->output_control = MT9P031_OUTPUT_CONTROL_DEF;
        mt9p031->mode2 = MT9P031_READ_MODE_2_ROW_BLC;
-       mt9p031->code = (uintptr_t)device_get_match_data(&client->dev);
+       info = device_get_match_data(&client->dev);
+       mt9p031->code = info->code;
 
        mt9p031->regulators[0].supply = "vdd";
        mt9p031->regulators[1].supply = "vdd_io";