hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/platform/exynos4-is/media-dev.c
....@@ -401,6 +401,7 @@
401401 int index = fmd->num_sensors;
402402 struct fimc_source_info *pd = &fmd->sensor[index].pdata;
403403 struct device_node *rem, *np;
404
+ struct v4l2_async_subdev *asd;
404405 struct v4l2_fwnode_endpoint endpoint = { .bus_type = 0 };
405406 int ret;
406407
....@@ -418,10 +419,10 @@
418419 pd->mux_id = (endpoint.base.port - 1) & 0x1;
419420
420421 rem = of_graph_get_remote_port_parent(ep);
421
- of_node_put(ep);
422422 if (rem == NULL) {
423423 v4l2_info(&fmd->v4l2_dev, "Remote device at %pOF not found\n",
424424 ep);
425
+ of_node_put(ep);
425426 return 0;
426427 }
427428
....@@ -450,6 +451,7 @@
450451 * checking parent's node name.
451452 */
452453 np = of_get_parent(rem);
454
+ of_node_put(rem);
453455
454456 if (of_node_name_eq(np, "i2c-isp"))
455457 pd->fimc_bus_type = FIMC_BUS_TYPE_ISP_WRITEBACK;
....@@ -458,20 +460,19 @@
458460 of_node_put(np);
459461
460462 if (WARN_ON(index >= ARRAY_SIZE(fmd->sensor))) {
461
- of_node_put(rem);
463
+ of_node_put(ep);
462464 return -EINVAL;
463465 }
464466
465
- fmd->sensor[index].asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
466
- fmd->sensor[index].asd.match.fwnode = of_fwnode_handle(rem);
467
+ asd = v4l2_async_notifier_add_fwnode_remote_subdev(
468
+ &fmd->subdev_notifier, of_fwnode_handle(ep), sizeof(*asd));
467469
468
- ret = v4l2_async_notifier_add_subdev(&fmd->subdev_notifier,
469
- &fmd->sensor[index].asd);
470
- if (ret) {
471
- of_node_put(rem);
472
- return ret;
473
- }
470
+ of_node_put(ep);
474471
472
+ if (IS_ERR(asd))
473
+ return PTR_ERR(asd);
474
+
475
+ fmd->sensor[index].asd = asd;
475476 fmd->num_sensors++;
476477
477478 return 0;
....@@ -1377,8 +1378,7 @@
13771378
13781379 /* Find platform data for this sensor subdev */
13791380 for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++)
1380
- if (fmd->sensor[i].asd.match.fwnode ==
1381
- of_fwnode_handle(subdev->dev->of_node))
1381
+ if (fmd->sensor[i].asd == asd)
13821382 si = &fmd->sensor[i];
13831383
13841384 if (si == NULL)
....@@ -1470,7 +1470,7 @@
14701470 pinctrl = devm_pinctrl_get(dev);
14711471 if (IS_ERR(pinctrl)) {
14721472 ret = PTR_ERR(pinctrl);
1473
- if (ret != EPROBE_DEFER)
1473
+ if (ret != -EPROBE_DEFER)
14741474 dev_err(dev, "Failed to get pinctrl: %d\n", ret);
14751475 goto err_clk;
14761476 }
....@@ -1582,7 +1582,11 @@
15821582 if (ret)
15831583 return ret;
15841584
1585
- return platform_driver_register(&fimc_md_driver);
1585
+ ret = platform_driver_register(&fimc_md_driver);
1586
+ if (ret)
1587
+ fimc_unregister_driver();
1588
+
1589
+ return ret;
15861590 }
15871591
15881592 static void __exit fimc_md_exit(void)