Change to use of_device_get_match_data() to get match data prior to allocating private data. All current entries in the of_device_id match table provide match data, so no functional change is intended.
Signed-off-by: Jonas Karlman <[email protected]> --- v2: No change --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 40df6d1be2bf..fd7cc1572a40 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -536,8 +536,8 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, { struct platform_device *pdev = to_platform_device(dev); struct device_node *np = dev_of_node(dev); + const struct dw_hdmi_plat_data *drv_data; struct dw_hdmi_plat_data *plat_data; - const struct of_device_id *match; struct drm_device *drm = data; struct drm_encoder *encoder; struct rockchip_hdmi *hdmi; @@ -546,13 +546,16 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, if (!np) return -ENODEV; + drv_data = of_device_get_match_data(dev); + if (!drv_data) + return -ENODEV; + hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); if (!hdmi) return -ENOMEM; - match = of_match_node(dw_hdmi_rockchip_dt_ids, np); - plat_data = devm_kmemdup(&pdev->dev, match->data, - sizeof(*plat_data), GFP_KERNEL); + plat_data = devm_kmemdup(&pdev->dev, drv_data, + sizeof(*drv_data), GFP_KERNEL); if (!plat_data) return -ENOMEM; -- 2.54.0
