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

+8 -17
+8 -17
drivers/gpu/drm/omapdrm/dss/sdi.c
··· 284 284 285 285 static void sdi_bridge_init(struct sdi_device *sdi) 286 286 { 287 - sdi->bridge.funcs = &sdi_bridge_funcs; 288 287 sdi->bridge.of_node = sdi->pdev->dev.of_node; 289 288 sdi->bridge.type = DRM_MODE_CONNECTOR_LVDS; 290 289 ··· 343 344 u32 datapairs; 344 345 int r; 345 346 346 - sdi = kzalloc(sizeof(*sdi), GFP_KERNEL); 347 - if (!sdi) 348 - return -ENOMEM; 347 + sdi = devm_drm_bridge_alloc(&pdev->dev, struct sdi_device, bridge, &sdi_bridge_funcs); 348 + if (IS_ERR(sdi)) 349 + return PTR_ERR(sdi); 349 350 350 351 ep = of_graph_get_next_port_endpoint(port, NULL); 351 - if (!ep) { 352 - r = 0; 353 - goto err_free; 354 - } 352 + if (!ep) 353 + return 0; 355 354 356 355 r = of_property_read_u32(ep, "datapairs", &datapairs); 357 356 of_node_put(ep); 358 357 if (r) { 359 358 DSSERR("failed to parse datapairs\n"); 360 - goto err_free; 359 + return r; 361 360 } 362 361 363 362 sdi->datapairs = datapairs; ··· 369 372 r = PTR_ERR(sdi->vdds_sdi_reg); 370 373 if (r != -EPROBE_DEFER) 371 374 DSSERR("can't get VDDS_SDI regulator\n"); 372 - goto err_free; 375 + return r; 373 376 } 374 377 375 378 r = sdi_init_output(sdi); 376 379 if (r) 377 - goto err_free; 380 + return r; 378 381 379 382 return 0; 380 - 381 - err_free: 382 - kfree(sdi); 383 - 384 - return r; 385 383 } 386 384 387 385 void sdi_uninit_port(struct device_node *port) ··· 387 395 return; 388 396 389 397 sdi_uninit_output(sdi); 390 - kfree(sdi); 391 398 }