Commit 50ec5b56 authored by Markus Elfring's avatar Markus Elfring Committed by Mihail Atanassov

drm/komeda: Use devm_platform_ioremap_resource() in komeda_dev_create()

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Reviewed-by: default avatarJames Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: default avatarMihail Atanassov <mihail.atanassov@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/64a6ea39-3e4b-2ebe-74f7-98720e581e3e@web.de
parent 6b1ce0a2
...@@ -184,19 +184,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev) ...@@ -184,19 +184,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
const struct komeda_product_data *product; const struct komeda_product_data *product;
struct komeda_dev *mdev; struct komeda_dev *mdev;
struct resource *io_res;
int err = 0; int err = 0;
product = of_device_get_match_data(dev); product = of_device_get_match_data(dev);
if (!product) if (!product)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!io_res) {
DRM_ERROR("No registers defined.\n");
return ERR_PTR(-ENODEV);
}
mdev = devm_kzalloc(dev, sizeof(*mdev), GFP_KERNEL); mdev = devm_kzalloc(dev, sizeof(*mdev), GFP_KERNEL);
if (!mdev) if (!mdev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -204,7 +197,7 @@ struct komeda_dev *komeda_dev_create(struct device *dev) ...@@ -204,7 +197,7 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
mutex_init(&mdev->lock); mutex_init(&mdev->lock);
mdev->dev = dev; mdev->dev = dev;
mdev->reg_base = devm_ioremap_resource(dev, io_res); mdev->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mdev->reg_base)) { if (IS_ERR(mdev->reg_base)) {
DRM_ERROR("Map register space failed.\n"); DRM_ERROR("Map register space failed.\n");
err = PTR_ERR(mdev->reg_base); err = PTR_ERR(mdev->reg_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment