diff options
author | Luca Ceresoli <luca.ceresoli@bootlin.com> | 2023-04-18 10:00:41 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-05-25 13:04:47 +0200 |
commit | 26b44232f581b2baa8a2e767b52db33a9c7e839b (patch) | |
tree | bbbe42c5028b931c705d8f1622994b88d6f0be23 /drivers | |
parent | 40ecb38e5c961174f86bfb4d5b1d2ae821cc45c2 (diff) | |
download | linux-stable-26b44232f581b2baa8a2e767b52db33a9c7e839b.tar.gz linux-stable-26b44232f581b2baa8a2e767b52db33a9c7e839b.tar.bz2 linux-stable-26b44232f581b2baa8a2e767b52db33a9c7e839b.zip |
staging: media: tegra-video: slightly simplify cleanup on errors
of_node_put(node) does nothing if node == NULL, so it can be moved to the
cleanup section at the bottom.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/media/tegra-video/vi.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index be27a93ebe2a..8deeeeedfd73 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -1354,7 +1354,7 @@ static int tegra_vi_channels_alloc(struct tegra_vi *vi) struct device_node *node = vi->dev->of_node; struct device_node *ep = NULL; struct device_node *ports; - struct device_node *port; + struct device_node *port = NULL; unsigned int port_num; struct device_node *parent; struct v4l2_fwnode_endpoint v4l2_ep = { .bus_type = 0 }; @@ -1377,7 +1377,6 @@ static int tegra_vi_channels_alloc(struct tegra_vi *vi) dev_err(vi->dev, "invalid port num %d for %pOF\n", port_num, port); ret = -EINVAL; - of_node_put(port); goto cleanup; } @@ -1400,13 +1399,12 @@ static int tegra_vi_channels_alloc(struct tegra_vi *vi) lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; ret = tegra_vi_channel_alloc(vi, port_num, port, lanes); - if (ret < 0) { - of_node_put(port); + if (ret < 0) goto cleanup; - } } cleanup: + of_node_put(port); of_node_put(ports); return ret; } |