]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: stm32: csi: remove useless fwnode_graph_get_endpoint call
authorAlain Volmat <alain.volmat@foss.st.com>
Mon, 13 Jan 2025 08:57:57 +0000 (09:57 +0100)
committerHans Verkuil <hverkuil@xs4all.nl>
Sat, 15 Feb 2025 14:22:49 +0000 (15:22 +0100)
The endpoint is already retrieved at the beginning of the function
stm32_csi_parse_dt hence keep the endpoint pointer until the end
instead of getting a new one.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/st/stm32/stm32-csi.c

index 4affbc00b042ce6f8c5308a79125e58cbfd1c9ba..1be12c9dcf55589085b7eb6588471f7d13bc8f50 100644 (file)
@@ -932,38 +932,32 @@ static int stm32_csi_parse_dt(struct stm32_csi_dev *csidev)
        }
 
        ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep);
-       fwnode_handle_put(ep);
        if (ret) {
                dev_err(csidev->dev, "Could not parse v4l2 endpoint\n");
-               return ret;
+               goto out;
        }
 
        csidev->num_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes;
        if (csidev->num_lanes > STM32_CSI_LANES_MAX) {
                dev_err(csidev->dev, "Unsupported number of data-lanes: %d\n",
                        csidev->num_lanes);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out;
        }
 
        memcpy(csidev->lanes, v4l2_ep.bus.mipi_csi2.data_lanes,
               sizeof(csidev->lanes));
 
-       ep = fwnode_graph_get_next_endpoint(dev_fwnode(csidev->dev), NULL);
-       if (!ep) {
-               dev_err(csidev->dev, "Failed to get next endpoint\n");
-               return -EINVAL;
-       }
-
        v4l2_async_subdev_nf_init(&csidev->notifier, &csidev->sd);
 
        asd = v4l2_async_nf_add_fwnode_remote(&csidev->notifier, ep,
                                              struct v4l2_async_connection);
 
-       fwnode_handle_put(ep);
 
        if (IS_ERR(asd)) {
                dev_err(csidev->dev, "Failed to add fwnode remote subdev\n");
-               return PTR_ERR(asd);
+               ret = PTR_ERR(asd);
+               goto out;
        }
 
        csidev->notifier.ops = &stm32_csi_notifier_ops;
@@ -972,9 +966,11 @@ static int stm32_csi_parse_dt(struct stm32_csi_dev *csidev)
        if (ret) {
                dev_err(csidev->dev, "Failed to register notifier\n");
                v4l2_async_nf_cleanup(&csidev->notifier);
-               return ret;
+               goto out;
        }
 
+out:
+       fwnode_handle_put(ep);
        return ret;
 }