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: hdmi4: 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-10-b8bc1f16d7aa@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

+10 -16
+10 -16
drivers/gpu/drm/omapdrm/dss/hdmi4.c
··· 505 505 506 506 static void hdmi4_bridge_init(struct omap_hdmi *hdmi) 507 507 { 508 - hdmi->bridge.funcs = &hdmi4_bridge_funcs; 509 508 hdmi->bridge.of_node = hdmi->pdev->dev.of_node; 510 509 hdmi->bridge.ops = DRM_BRIDGE_OP_EDID; 511 510 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA; ··· 760 761 int irq; 761 762 int r; 762 763 763 - hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL); 764 - if (!hdmi) 765 - return -ENOMEM; 764 + hdmi = devm_drm_bridge_alloc(&pdev->dev, struct omap_hdmi, bridge, &hdmi4_bridge_funcs); 765 + if (IS_ERR(hdmi)) 766 + return PTR_ERR(hdmi); 766 767 767 768 hdmi->pdev = pdev; 768 769 ··· 773 774 774 775 r = hdmi4_probe_of(hdmi); 775 776 if (r) 776 - goto err_free; 777 + return r; 777 778 778 779 r = hdmi_wp_init(pdev, &hdmi->wp, 4); 779 780 if (r) 780 - goto err_free; 781 + return r; 781 782 782 783 r = hdmi_phy_init(pdev, &hdmi->phy, 4); 783 784 if (r) 784 - goto err_free; 785 + return r; 785 786 786 787 r = hdmi4_core_init(pdev, &hdmi->core); 787 788 if (r) 788 - goto err_free; 789 + return r; 789 790 790 791 irq = platform_get_irq(pdev, 0); 791 792 if (irq < 0) { 792 793 DSSERR("platform_get_irq failed\n"); 793 - r = -ENODEV; 794 - goto err_free; 794 + return -ENODEV; 795 795 } 796 796 797 797 r = devm_request_threaded_irq(&pdev->dev, irq, ··· 798 800 IRQF_ONESHOT, "OMAP HDMI", hdmi); 799 801 if (r) { 800 802 DSSERR("HDMI IRQ request failed\n"); 801 - goto err_free; 803 + return r; 802 804 } 803 805 804 806 hdmi->vdda_reg = devm_regulator_get(&pdev->dev, "vdda"); ··· 806 808 r = PTR_ERR(hdmi->vdda_reg); 807 809 if (r != -EPROBE_DEFER) 808 810 DSSERR("can't get VDDA regulator\n"); 809 - goto err_free; 811 + return r; 810 812 } 811 813 812 814 pm_runtime_enable(&pdev->dev); ··· 825 827 hdmi4_uninit_output(hdmi); 826 828 err_pm_disable: 827 829 pm_runtime_disable(&pdev->dev); 828 - err_free: 829 - kfree(hdmi); 830 830 return r; 831 831 } 832 832 ··· 837 841 hdmi4_uninit_output(hdmi); 838 842 839 843 pm_runtime_disable(&pdev->dev); 840 - 841 - kfree(hdmi); 842 844 } 843 845 844 846 static const struct of_device_id hdmi_of_match[] = {