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/atmel-hlcdc: use drmm_simple_encoder_alloc()

Simplify the code using drmm_simple_encoder_alloc to handle allocation
and initialization at once.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Link: https://patch.msgid.link/20251218-lcd_cleanup_mainline-v2-3-df837aba878f@microchip.com
Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>

authored by

Ludovic Desroches and committed by
Manikandan Muralidharan
227ef8cf 87cac7a5

+10 -19
+10 -19
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
··· 73 73 struct drm_bridge *bridge; 74 74 int ret; 75 75 76 + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, 77 + &panel, &bridge); 78 + if (ret) 79 + return ret; 80 + 81 + output = drmm_simple_encoder_alloc(dev, struct atmel_hlcdc_rgb_output, 82 + encoder, DRM_MODE_ENCODER_NONE); 83 + if (IS_ERR(output)) 84 + return PTR_ERR(output); 85 + 76 86 ep = of_graph_get_endpoint_by_regs(dev->dev->of_node, 0, endpoint); 77 87 if (!ep) 78 88 return -ENODEV; 79 - 80 - ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, 81 - &panel, &bridge); 82 - if (ret) { 83 - of_node_put(ep); 84 - return ret; 85 - } 86 - 87 - output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL); 88 - if (!output) { 89 - of_node_put(ep); 90 - return -ENOMEM; 91 - } 92 89 93 90 output->bus_fmt = atmel_hlcdc_of_bus_fmt(ep); 94 91 of_node_put(ep); ··· 94 97 return -EINVAL; 95 98 } 96 99 97 - ret = drm_simple_encoder_init(dev, &output->encoder, 98 - DRM_MODE_ENCODER_NONE); 99 - if (ret) 100 - return ret; 101 100 102 101 output->encoder.possible_crtcs = 0x1; 103 102 ··· 112 119 if (panel) 113 120 drm_panel_bridge_remove(bridge); 114 121 } 115 - 116 - drm_encoder_cleanup(&output->encoder); 117 122 118 123 return ret; 119 124 }