[PATCH] drm/aspeed: Use of_device_get_match_data()

From: cgel . zte
Date: Sun Feb 13 2022 - 21:05:10 EST


From: "Minghao Chi (CGEL ZTE)" <chi.minghao@xxxxxxxxxx>

Use of_device_get_match_data() to simplify the code.

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@xxxxxxxxxx>
---
drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
index 65f172807a0d..9fe1983bd9c3 100644
--- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
+++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
@@ -132,7 +132,6 @@ static int aspeed_gfx_load(struct drm_device *drm)
struct aspeed_gfx *priv = to_aspeed_gfx(drm);
struct device_node *np = pdev->dev.of_node;
const struct aspeed_gfx_config *config;
- const struct of_device_id *match;
struct resource *res;
int ret;

@@ -141,10 +140,7 @@ static int aspeed_gfx_load(struct drm_device *drm)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);

- match = of_match_device(aspeed_gfx_match, &pdev->dev);
- if (!match)
- return -EINVAL;
- config = match->data;
+ config = of_device_get_match_data(&pdev->dev);

priv->dac_reg = config->dac_reg;
priv->vga_scratch_reg = config->vga_scratch_reg;
--
2.25.1