drm/etnaviv: Check for platform_device_register_simple() failure
platform_device_register_simple() may fail, so we should better
check its return value and propagate it in the case of error.
Cc: <stable@vger.kernel.org>
Fixes: 246774d17f
("drm/etnaviv: remove the need for a gpu-subsystem DT node")
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
This commit is contained in:
parent
ce397d215c
commit
45a0faaba9
@ -631,8 +631,11 @@ static struct platform_driver etnaviv_platform_driver = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct platform_device *etnaviv_drm;
|
||||||
|
|
||||||
static int __init etnaviv_init(void)
|
static int __init etnaviv_init(void)
|
||||||
{
|
{
|
||||||
|
struct platform_device *pdev;
|
||||||
int ret;
|
int ret;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
|
|
||||||
@ -644,7 +647,7 @@ static int __init etnaviv_init(void)
|
|||||||
|
|
||||||
ret = platform_driver_register(&etnaviv_platform_driver);
|
ret = platform_driver_register(&etnaviv_platform_driver);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
platform_driver_unregister(&etnaviv_gpu_driver);
|
goto unregister_gpu_driver;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the DT contains at least one available GPU device, instantiate
|
* If the DT contains at least one available GPU device, instantiate
|
||||||
@ -653,12 +656,24 @@ static int __init etnaviv_init(void)
|
|||||||
for_each_compatible_node(np, NULL, "vivante,gc") {
|
for_each_compatible_node(np, NULL, "vivante,gc") {
|
||||||
if (!of_device_is_available(np))
|
if (!of_device_is_available(np))
|
||||||
continue;
|
continue;
|
||||||
|
pdev = platform_device_register_simple("etnaviv", -1,
|
||||||
platform_device_register_simple("etnaviv", -1, NULL, 0);
|
NULL, 0);
|
||||||
|
if (IS_ERR(pdev)) {
|
||||||
|
ret = PTR_ERR(pdev);
|
||||||
|
of_node_put(np);
|
||||||
|
goto unregister_platform_driver;
|
||||||
|
}
|
||||||
|
etnaviv_drm = pdev;
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
unregister_platform_driver:
|
||||||
|
platform_driver_unregister(&etnaviv_platform_driver);
|
||||||
|
unregister_gpu_driver:
|
||||||
|
platform_driver_unregister(&etnaviv_gpu_driver);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
module_init(etnaviv_init);
|
module_init(etnaviv_init);
|
||||||
|
Loading…
Reference in New Issue
Block a user