Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/omap: dss: hdmi5: convert to devm_drm_bridge_alloc() API

This is the new API for allocating DRM bridges.

Switching from a non-devm to a devm allocation allows removing the kfree()
in the remove function and in the probe error management code, and as a
consequence to simplify the code flow by removing now unnecessary gotos.

Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20250509-drm-bridge-convert-to-alloc-api-v3-11-b8bc1f16d7aa@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

+10 -16
+10 -16
drivers/gpu/drm/omapdrm/dss/hdmi5.c
··· 480 480 481 481 static void hdmi5_bridge_init(struct omap_hdmi *hdmi) 482 482 { 483 - hdmi->bridge.funcs = &hdmi5_bridge_funcs; 484 483 hdmi->bridge.of_node = hdmi->pdev->dev.of_node; 485 484 hdmi->bridge.ops = DRM_BRIDGE_OP_EDID; 486 485 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA; ··· 726 727 int irq; 727 728 int r; 728 729 729 - hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL); 730 - if (!hdmi) 731 - return -ENOMEM; 730 + hdmi = devm_drm_bridge_alloc(&pdev->dev, struct omap_hdmi, bridge, &hdmi5_bridge_funcs); 731 + if (IS_ERR(hdmi)) 732 + return PTR_ERR(hdmi); 732 733 733 734 hdmi->pdev = pdev; 734 735 ··· 739 740 740 741 r = hdmi5_probe_of(hdmi); 741 742 if (r) 742 - goto err_free; 743 + return r; 743 744 744 745 r = hdmi_wp_init(pdev, &hdmi->wp, 5); 745 746 if (r) 746 - goto err_free; 747 + return r; 747 748 748 749 r = hdmi_phy_init(pdev, &hdmi->phy, 5); 749 750 if (r) 750 - goto err_free; 751 + return r; 751 752 752 753 r = hdmi5_core_init(pdev, &hdmi->core); 753 754 if (r) 754 - goto err_free; 755 + return r; 755 756 756 757 irq = platform_get_irq(pdev, 0); 757 758 if (irq < 0) { 758 759 DSSERR("platform_get_irq failed\n"); 759 - r = -ENODEV; 760 - goto err_free; 760 + return -ENODEV; 761 761 } 762 762 763 763 r = devm_request_threaded_irq(&pdev->dev, irq, ··· 764 766 IRQF_ONESHOT, "OMAP HDMI", hdmi); 765 767 if (r) { 766 768 DSSERR("HDMI IRQ request failed\n"); 767 - goto err_free; 769 + return r; 768 770 } 769 771 770 772 hdmi->vdda_reg = devm_regulator_get(&pdev->dev, "vdda"); ··· 772 774 r = PTR_ERR(hdmi->vdda_reg); 773 775 if (r != -EPROBE_DEFER) 774 776 DSSERR("can't get VDDA regulator\n"); 775 - goto err_free; 777 + return r; 776 778 } 777 779 778 780 pm_runtime_enable(&pdev->dev); ··· 791 793 hdmi5_uninit_output(hdmi); 792 794 err_pm_disable: 793 795 pm_runtime_disable(&pdev->dev); 794 - err_free: 795 - kfree(hdmi); 796 796 return r; 797 797 } 798 798 ··· 803 807 hdmi5_uninit_output(hdmi); 804 808 805 809 pm_runtime_disable(&pdev->dev); 806 - 807 - kfree(hdmi); 808 810 } 809 811 810 812 static const struct of_device_id hdmi_of_match[] = {