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

+8 -15
+8 -15
drivers/gpu/drm/omapdrm/dss/venc.c
··· 664 664 665 665 static void venc_bridge_init(struct venc_device *venc) 666 666 { 667 - venc->bridge.funcs = &venc_bridge_funcs; 668 667 venc->bridge.of_node = venc->pdev->dev.of_node; 669 668 venc->bridge.ops = DRM_BRIDGE_OP_MODES; 670 669 venc->bridge.type = DRM_MODE_CONNECTOR_SVIDEO; ··· 808 809 struct venc_device *venc; 809 810 int r; 810 811 811 - venc = kzalloc(sizeof(*venc), GFP_KERNEL); 812 - if (!venc) 813 - return -ENOMEM; 812 + venc = devm_drm_bridge_alloc(&pdev->dev, struct venc_device, bridge, &venc_bridge_funcs); 813 + if (IS_ERR(venc)) 814 + return PTR_ERR(venc); 814 815 815 816 venc->pdev = pdev; 816 817 ··· 823 824 venc->config = &venc_config_pal_trm; 824 825 825 826 venc->base = devm_platform_ioremap_resource(pdev, 0); 826 - if (IS_ERR(venc->base)) { 827 - r = PTR_ERR(venc->base); 828 - goto err_free; 829 - } 827 + if (IS_ERR(venc->base)) 828 + return PTR_ERR(venc->base); 830 829 831 830 venc->vdda_dac_reg = devm_regulator_get(&pdev->dev, "vdda"); 832 831 if (IS_ERR(venc->vdda_dac_reg)) { 833 832 r = PTR_ERR(venc->vdda_dac_reg); 834 833 if (r != -EPROBE_DEFER) 835 834 DSSERR("can't get VDDA_DAC regulator\n"); 836 - goto err_free; 835 + return r; 837 836 } 838 837 839 838 r = venc_get_clocks(venc); 840 839 if (r) 841 - goto err_free; 840 + return r; 842 841 843 842 r = venc_probe_of(venc); 844 843 if (r) 845 - goto err_free; 844 + return r; 846 845 847 846 pm_runtime_enable(&pdev->dev); 848 847 ··· 858 861 venc_uninit_output(venc); 859 862 err_pm_disable: 860 863 pm_runtime_disable(&pdev->dev); 861 - err_free: 862 - kfree(venc); 863 864 return r; 864 865 } 865 866 ··· 870 875 venc_uninit_output(venc); 871 876 872 877 pm_runtime_disable(&pdev->dev); 873 - 874 - kfree(venc); 875 878 } 876 879 877 880 static __maybe_unused int venc_runtime_suspend(struct device *dev)