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

Configure Feed

Select the types of activity you want to include in your feed.

media: ov2740: identify module after subdev initialisation

The module identifying will try to get the sub device data which
will be ready after sub device initialisation, so if try to use the
subdev data to deference the client will cause NULL pointer
dereference, this patch move the module identification after
v4l2_i2c_subdev_init() to fix this issue, it also fixes duplicate
module idendification.

Fixes: ada2c4f54d0a ("media: ov2740: support device probe in non-zero ACPI D state")
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Bingbu Cao and committed by
Mauro Carvalho Chehab
54ade663 e9b06e21

+1 -7
+1 -7
drivers/media/i2c/ov2740.c
··· 1162 1162 if (!ov2740) 1163 1163 return -ENOMEM; 1164 1164 1165 + v4l2_i2c_subdev_init(&ov2740->sd, client, &ov2740_subdev_ops); 1165 1166 full_power = acpi_dev_state_d0(&client->dev); 1166 1167 if (full_power) { 1167 1168 ret = ov2740_identify_module(ov2740); ··· 1170 1169 dev_err(&client->dev, "failed to find sensor: %d", ret); 1171 1170 return ret; 1172 1171 } 1173 - } 1174 - 1175 - v4l2_i2c_subdev_init(&ov2740->sd, client, &ov2740_subdev_ops); 1176 - ret = ov2740_identify_module(ov2740); 1177 - if (ret) { 1178 - dev_err(&client->dev, "failed to find sensor: %d", ret); 1179 - return ret; 1180 1172 } 1181 1173 1182 1174 mutex_init(&ov2740->mutex);