Skip to content

Commit 9ba2556

Browse files
jhovoldChun-Kuang Hu
authored andcommitted
drm/mediatek: clean up driver data initialisation
The platform and drm devices are only used to look up the drm device and its driver data respectively when initialising the driver data during bind(). Drop the reference counts as soon as they have been used to make the code more readable. Note that the crtc count is never incremented on lookup failures. Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: CK Hu <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 4de37a4 commit 9ba2556

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,14 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
394394
continue;
395395

396396
drm_dev = device_find_child(&pdev->dev, NULL, mtk_drm_match);
397+
put_device(&pdev->dev);
397398
if (!drm_dev)
398-
goto next_put_device_pdev_dev;
399+
continue;
399400

400401
temp_drm_priv = dev_get_drvdata(drm_dev);
402+
put_device(drm_dev);
401403
if (!temp_drm_priv)
402-
goto next_put_device_drm_dev;
404+
continue;
403405

404406
if (temp_drm_priv->data->main_len)
405407
all_drm_priv[CRTC_MAIN] = temp_drm_priv;
@@ -411,12 +413,6 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
411413
if (temp_drm_priv->mtk_drm_bound)
412414
cnt++;
413415

414-
next_put_device_drm_dev:
415-
put_device(drm_dev);
416-
417-
next_put_device_pdev_dev:
418-
put_device(&pdev->dev);
419-
420416
if (cnt == MAX_CRTC) {
421417
of_node_put(node);
422418
break;

0 commit comments

Comments
 (0)