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/rockchip: dw_hdmi_qp: Improve error handling with dev_err_probe()

The error handling in dw_hdmi_qp_rockchip_bind() is quite inconsistent,
i.e. in some cases the error code is not included in the message, while
in some other cases there is no check for -EPROBE_DEFER.

Since this is part of the probe path, address the aforementioned issues
by switching to dev_err_probe(), which also reduces the code a bit.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20250903-rk3588-hdmi-cec-v4-3-fa25163c4b08@collabora.com

authored by

Cristian Ciocaltea and committed by
Heiko Stuebner
b6736a4e f7a1de0d

+24 -38
+24 -38
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
··· 455 455 return -ENODEV; 456 456 457 457 if (!cfg->ctrl_ops || !cfg->ctrl_ops->io_init || 458 - !cfg->ctrl_ops->irq_callback || !cfg->ctrl_ops->hardirq_callback) { 459 - dev_err(dev, "Missing platform ctrl ops\n"); 460 - return -ENODEV; 461 - } 458 + !cfg->ctrl_ops->irq_callback || !cfg->ctrl_ops->hardirq_callback) 459 + return dev_err_probe(dev, -ENODEV, "Missing platform ctrl ops\n"); 462 460 463 461 hdmi->ctrl_ops = cfg->ctrl_ops; 464 462 hdmi->dev = &pdev->dev; ··· 469 471 break; 470 472 } 471 473 } 472 - if (hdmi->port_id < 0) { 473 - dev_err(hdmi->dev, "Failed to match HDMI port ID\n"); 474 - return hdmi->port_id; 475 - } 474 + if (hdmi->port_id < 0) 475 + return dev_err_probe(hdmi->dev, hdmi->port_id, 476 + "Failed to match HDMI port ID\n"); 476 477 477 478 plat_data.phy_ops = cfg->phy_ops; 478 479 plat_data.phy_data = hdmi; ··· 492 495 493 496 hdmi->regmap = syscon_regmap_lookup_by_phandle(dev->of_node, 494 497 "rockchip,grf"); 495 - if (IS_ERR(hdmi->regmap)) { 496 - dev_err(hdmi->dev, "Unable to get rockchip,grf\n"); 497 - return PTR_ERR(hdmi->regmap); 498 - } 498 + if (IS_ERR(hdmi->regmap)) 499 + return dev_err_probe(hdmi->dev, PTR_ERR(hdmi->regmap), 500 + "Unable to get rockchip,grf\n"); 499 501 500 502 hdmi->vo_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, 501 503 "rockchip,vo-grf"); 502 - if (IS_ERR(hdmi->vo_regmap)) { 503 - dev_err(hdmi->dev, "Unable to get rockchip,vo-grf\n"); 504 - return PTR_ERR(hdmi->vo_regmap); 505 - } 504 + if (IS_ERR(hdmi->vo_regmap)) 505 + return dev_err_probe(hdmi->dev, PTR_ERR(hdmi->vo_regmap), 506 + "Unable to get rockchip,vo-grf\n"); 506 507 507 508 ret = devm_clk_bulk_get_all_enabled(hdmi->dev, &clks); 508 - if (ret < 0) { 509 - dev_err(hdmi->dev, "Failed to get clocks: %d\n", ret); 510 - return ret; 511 - } 509 + if (ret < 0) 510 + return dev_err_probe(hdmi->dev, ret, "Failed to get clocks\n"); 512 511 513 512 hdmi->enable_gpio = devm_gpiod_get_optional(hdmi->dev, "enable", 514 513 GPIOD_OUT_HIGH); 515 - if (IS_ERR(hdmi->enable_gpio)) { 516 - ret = PTR_ERR(hdmi->enable_gpio); 517 - dev_err(hdmi->dev, "Failed to request enable GPIO: %d\n", ret); 518 - return ret; 519 - } 514 + if (IS_ERR(hdmi->enable_gpio)) 515 + return dev_err_probe(hdmi->dev, PTR_ERR(hdmi->enable_gpio), 516 + "Failed to request enable GPIO\n"); 520 517 521 518 hdmi->phy = devm_of_phy_get_by_index(dev, dev->of_node, 0); 522 - if (IS_ERR(hdmi->phy)) { 523 - ret = PTR_ERR(hdmi->phy); 524 - if (ret != -EPROBE_DEFER) 525 - dev_err(hdmi->dev, "failed to get phy: %d\n", ret); 526 - return ret; 527 - } 519 + if (IS_ERR(hdmi->phy)) 520 + return dev_err_probe(hdmi->dev, PTR_ERR(hdmi->phy), 521 + "Failed to get phy\n"); 528 522 529 523 cfg->ctrl_ops->io_init(hdmi); 530 524 ··· 544 556 545 557 hdmi->hdmi = dw_hdmi_qp_bind(pdev, encoder, &plat_data); 546 558 if (IS_ERR(hdmi->hdmi)) { 547 - ret = PTR_ERR(hdmi->hdmi); 548 559 drm_encoder_cleanup(encoder); 549 - return ret; 560 + return dev_err_probe(hdmi->dev, PTR_ERR(hdmi->hdmi), 561 + "Failed to bind dw-hdmi-qp"); 550 562 } 551 563 552 564 connector = drm_bridge_connector_init(drm, encoder); 553 - if (IS_ERR(connector)) { 554 - ret = PTR_ERR(connector); 555 - dev_err(hdmi->dev, "failed to init bridge connector: %d\n", ret); 556 - return ret; 557 - } 565 + if (IS_ERR(connector)) 566 + return dev_err_probe(hdmi->dev, PTR_ERR(connector), 567 + "Failed to init bridge connector\n"); 558 568 559 569 return drm_connector_attach_encoder(connector, encoder); 560 570 }