media: coda: Fix missing put_device() call in coda_get_vdoa_data
PATCH 1/1 media: coda: Fix missing put_device() call in coda_get_vdoa_data
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.
--- drivers/media/platform/coda/coda-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/coda/coda-common.c +5 -1
@@ -405,9 +405,13 @@ static struct vdoa_data *coda_get_vdoa_data(void) goto out; vdoa_data =platform_get_drvdata (vdoa_pdev); -if (!vdoa_data) +if (!vdoa_data) { vdoa_data =ERR_PTR (-EPROBE_DEFER ); + goto put; + } +put: +put_device (&vdoa_pdev->dev); out:of_node_put (vdoa_node);
Signature · 1 line
2.17.1
Quoted 15 lines · Miaoqian Lin
The reference taken by '
of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.Fixes e7f3c5481035 ("[media] coda: use VDOA for un-tiling custom macroblock format")Signed-off-by Miaoqian Lin <[email protected]>--- drivers/media/platform/coda/coda-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/media/platform/coda/coda-common.c +0
-0
drivers/media/platform/coda/coda-common.c static struct vdoa_data *coda_get_vdoa_data(void) · line 410
Quoted 7 lines
drivers/media/platform/coda/coda-common.c +2
-1@@ -405,9 +405,13 @@ static struct vdoa_data *coda_get_vdoa_data(void) goto out; vdoa_data =platform_get_drvdata (vdoa_pdev); -if (!vdoa_data) +if (!vdoa_data) { vdoa_data =ERR_PTR (-EPROBE_DEFER ); + goto put;
Why the goto put? Just drop the goto...
drivers/media/platform/coda/coda-common.c static struct vdoa_data *coda_get_vdoa_data(void) · line 413
Quoted 3 lines
drivers/media/platform/coda/coda-common.c +2
-0+ } +put:
...and this label.
drivers/media/platform/coda/coda-common.c static struct vdoa_data *coda_get_vdoa_data(void) · line 414
Quoted 1 line
drivers/media/platform/coda/coda-common.c +1
-0+put_device (&vdoa_pdev->dev);
This is the real fix :-)
Regards,
Hans
Quoted 3 lines
drivers/media/platform/coda/coda-common.c +0
-0out:of_node_put (vdoa_node);
PATCH v2 1/1 media: coda: Fix missing put_device() call in coda_get_vdoa_data
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.
---
Changes in v2:
- remove the goto and unused label.
--- drivers/media/platform/coda/coda-common.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/coda/coda-common.c +1 -0
@@ -408,6 +408,7 @@ static struct vdoa_data *coda_get_vdoa_data(void)if (!vdoa_data) vdoa_data =ERR_PTR (-EPROBE_DEFER ); +put_device (&vdoa_pdev->dev); out:of_node_put (vdoa_node);
Signature · 1 line
2.17.1