| .. | .. |
|---|
| 361 | 361 | |
|---|
| 362 | 362 | static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx) |
|---|
| 363 | 363 | { |
|---|
| 364 | | - struct v4l2_fwnode_endpoint v4l2_ep; |
|---|
| 364 | + struct v4l2_fwnode_endpoint v4l2_ep = { .bus_type = 0 }; |
|---|
| 365 | 365 | struct fwnode_handle *fwh; |
|---|
| 366 | 366 | struct device_node *ep; |
|---|
| 367 | 367 | int ret; |
|---|
| .. | .. |
|---|
| 378 | 378 | return ret; |
|---|
| 379 | 379 | } |
|---|
| 380 | 380 | |
|---|
| 381 | | - if (v4l2_ep.bus_type != V4L2_MBUS_CSI2) { |
|---|
| 381 | + if (v4l2_ep.bus_type != V4L2_MBUS_CSI2_DPHY) { |
|---|
| 382 | 382 | dev_err(csi2rx->dev, "Unsupported media bus type: 0x%x\n", |
|---|
| 383 | 383 | v4l2_ep.bus_type); |
|---|
| 384 | 384 | of_node_put(ep); |
|---|
| .. | .. |
|---|
| 399 | 399 | csi2rx->asd.match_type = V4L2_ASYNC_MATCH_FWNODE; |
|---|
| 400 | 400 | of_node_put(ep); |
|---|
| 401 | 401 | |
|---|
| 402 | | - csi2rx->notifier.subdevs = devm_kzalloc(csi2rx->dev, |
|---|
| 403 | | - sizeof(*csi2rx->notifier.subdevs), |
|---|
| 404 | | - GFP_KERNEL); |
|---|
| 405 | | - if (!csi2rx->notifier.subdevs) |
|---|
| 406 | | - return -ENOMEM; |
|---|
| 402 | + v4l2_async_notifier_init(&csi2rx->notifier); |
|---|
| 407 | 403 | |
|---|
| 408 | | - csi2rx->notifier.subdevs[0] = &csi2rx->asd; |
|---|
| 409 | | - csi2rx->notifier.num_subdevs = 1; |
|---|
| 404 | + ret = v4l2_async_notifier_add_subdev(&csi2rx->notifier, &csi2rx->asd); |
|---|
| 405 | + if (ret) { |
|---|
| 406 | + fwnode_handle_put(csi2rx->asd.match.fwnode); |
|---|
| 407 | + return ret; |
|---|
| 408 | + } |
|---|
| 409 | + |
|---|
| 410 | 410 | csi2rx->notifier.ops = &csi2rx_notifier_ops; |
|---|
| 411 | 411 | |
|---|
| 412 | | - return v4l2_async_subdev_notifier_register(&csi2rx->subdev, |
|---|
| 413 | | - &csi2rx->notifier); |
|---|
| 412 | + ret = v4l2_async_subdev_notifier_register(&csi2rx->subdev, |
|---|
| 413 | + &csi2rx->notifier); |
|---|
| 414 | + if (ret) |
|---|
| 415 | + v4l2_async_notifier_cleanup(&csi2rx->notifier); |
|---|
| 416 | + |
|---|
| 417 | + return ret; |
|---|
| 414 | 418 | } |
|---|
| 415 | 419 | |
|---|
| 416 | 420 | static int csi2rx_probe(struct platform_device *pdev) |
|---|
| .. | .. |
|---|
| 450 | 454 | ret = media_entity_pads_init(&csi2rx->subdev.entity, CSI2RX_PAD_MAX, |
|---|
| 451 | 455 | csi2rx->pads); |
|---|
| 452 | 456 | if (ret) |
|---|
| 453 | | - goto err_free_priv; |
|---|
| 457 | + goto err_cleanup; |
|---|
| 454 | 458 | |
|---|
| 455 | 459 | ret = v4l2_async_register_subdev(&csi2rx->subdev); |
|---|
| 456 | 460 | if (ret < 0) |
|---|
| 457 | | - goto err_free_priv; |
|---|
| 461 | + goto err_cleanup; |
|---|
| 458 | 462 | |
|---|
| 459 | 463 | dev_info(&pdev->dev, |
|---|
| 460 | 464 | "Probed CSI2RX with %u/%u lanes, %u streams, %s D-PHY\n", |
|---|
| .. | .. |
|---|
| 463 | 467 | |
|---|
| 464 | 468 | return 0; |
|---|
| 465 | 469 | |
|---|
| 470 | +err_cleanup: |
|---|
| 471 | + v4l2_async_notifier_cleanup(&csi2rx->notifier); |
|---|
| 466 | 472 | err_free_priv: |
|---|
| 467 | 473 | kfree(csi2rx); |
|---|
| 468 | 474 | return ret; |
|---|