On Fri, Oct 23, 2020 at 07:45:44PM +0200, Paul Kocialkowski wrote:
> +static int sun8i_a83t_mipi_csi2_v4l2_setup(struct sun8i_a83t_mipi_csi2_dev 
> *cdev)
> +{
> +     struct sun8i_a83t_mipi_csi2_video *video = &cdev->video;
> +     struct v4l2_subdev *subdev = &video->subdev;
> +     struct v4l2_async_notifier *notifier = &video->notifier;
> +     struct fwnode_handle *handle;
> +     struct v4l2_fwnode_endpoint *endpoint;
> +     int ret;
> +
> +     /* Subdev */
> +
> +     v4l2_subdev_init(subdev, &sun8i_a83t_mipi_csi2_subdev_ops);
> +     subdev->dev = cdev->dev;
> +     strscpy(subdev->name, MODULE_NAME, sizeof(subdev->name));
> +     v4l2_set_subdevdata(subdev, cdev);
> +
> +     /* Entity */
> +
> +     subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
> +     subdev->entity.ops = &sun8i_a83t_mipi_csi2_entity_ops;
> +
> +     /* Pads */
> +
> +     video->pads[0].flags = MEDIA_PAD_FL_SINK;
> +     video->pads[1].flags = MEDIA_PAD_FL_SOURCE;
> +
> +     ret = media_entity_pads_init(&subdev->entity, 2, video->pads);
> +     if (ret)
> +             return ret;
> +
> +     /* Endpoint */
> +
> +     handle = fwnode_graph_get_endpoint_by_id(dev_fwnode(cdev->dev), 0, 0,
> +                                              FWNODE_GRAPH_ENDPOINT_NEXT);
> +     if (!handle)
> +             goto error_media_entity;

Missing error code.

> +
> +     endpoint = &video->endpoint;
> +     endpoint->bus_type = V4L2_MBUS_CSI2_DPHY;
> +
> +     ret = v4l2_fwnode_endpoint_parse(handle, endpoint);
> +     fwnode_handle_put(handle);
> +     if (ret)
> +             goto error_media_entity;
> +
> +     /* Notifier */
> +
> +     v4l2_async_notifier_init(notifier);
> +
> +     ret = v4l2_async_notifier_add_fwnode_remote_subdev(notifier, handle,
> +                                                        
> &video->subdev_async);
> +     if (ret)
> +             goto error_media_entity;
> +
> +     video->notifier.ops = &sun8i_a83t_mipi_csi2_notifier_ops;
> +
> +     ret = v4l2_async_subdev_notifier_register(subdev, notifier);
> +     if (ret < 0)
> +             goto error_notifier;
> +
> +     /* Subdev */
> +
> +     ret = v4l2_async_register_subdev(subdev);
> +     if (ret < 0)
> +             goto error_notifier_registered;
> +
> +     return 0;
> +
> +error_notifier_registered:
> +     v4l2_async_notifier_unregister(notifier);
> +error_notifier:
> +     v4l2_async_notifier_cleanup(notifier);
> +error_media_entity:
> +     media_entity_cleanup(&subdev->entity);
> +
> +     return ret;
> +}


regards,
dan carpenter

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20201026085331.GC1042%40kadam.

Reply via email to