Skip to contentSkip to conversation

via-camera: check viafb_find_i2c_adapter() result to NULL

PATCH New Dzianis Kahanovich 1 participant 1 message Jan 4, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 via-camera: check viafb_find_i2c_adapter() result to NULL

If viafb_find_i2c_adapter() patch still useful - via-camera.c must be fixed too.

---

drivers/media/video/via-camera.c +3 -2
@@ -1344,8 +1344,9 @@ static __devinit int viacam_probe(struct
 	 * is OLPC-specific.  0x42 assumption is ov7670-specific.
 	 */
 	sensor_adapter = viafb_find_i2c_adapter(VIA_PORT_31);
-	cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, sensor_adapter,
-			"ov7670", 0x42 >> 1, NULL);
+	if (sensor_adapter != NULL)
+		cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev,
+			sensor_adapter, "ov7670", 0x42 >> 1, NULL);
 	if (cam->sensor = NULL) {
 		dev_err(&pdev->dev, "Unable to find the sensor!\n");
 		ret = -ENODEV;

--