Skip to contentSkip to conversation

video: fbdev: gbefb: Only instantiate device when built for IP32

PATCH In review Mark Brown 2 participants 2 messages Sep 21, 2021 – Sep 30, 2021 Framebuffer layer

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 video: fbdev: gbefb: Only instantiate device when built for IP32

The gbefb driver not only registers a driver but also the device for that driver. This is all well and good when run on the IP32 machines that are supported by the driver but since the driver supports building with COMPILE_TEST we might also be building on other platforms which do not have this hardware and will crash instantiating the driver. Add an IS_ENABLED() check so we compile out the device registration if we don't have the Kconfig option for the machine enabled.

Fixes 552ccf6b259d290c0c ("video: fbdev: gbefb: add COMPILE_TEST support")
Cc Bartlomiej Zolnierkiewicz <[email protected]>
---
 drivers/video/fbdev/gbefb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/gbefb.c +1 -1
index c5b99a4861e8..6b4d5a7f3e15 100644
@@ -1267,7 +1267,7 @@ static struct platform_device *gbefb_device;
 static int __init gbefb_init(void)
 {
 	int ret = platform_driver_register(&gbefb_driver);
-	if (!ret) {
+	if (IS_ENABLED(CONFIG_SGI_IP32) && !ret) {
 		gbefb_device = platform_device_alloc("gbefb", 0);
 		if (gbefb_device) {
 			ret = platform_device_add(gbefb_device);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 11 lines · Mark Brown

The gbefb driver not only registers a driver but also the device for that driver. This is all well and good when run on the IP32 machines that are supported by the driver but since the driver supports building with COMPILE_TEST we might also be building on other platforms which do not have this hardware and will crash instantiating the driver. Add an IS_ENABLED() check so we compile out the device registration if we don't have the Kconfig option for the machine enabled.

Fixes 552ccf6b259d290c0c ("video: fbdev: gbefb: add COMPILE_TEST support")
Cc Bartlomiej Zolnierkiewicz <[email protected]>

Stuffed into drm-misc-fixes, thanks for the patch. -Daniel

Quoted 20 lines
---
 drivers/video/fbdev/gbefb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/gbefb.c +1 -1
index c5b99a4861e8..6b4d5a7f3e15 100644
@@ -1267,7 +1267,7 @@ static struct platform_device *gbefb_device;
 static int __init gbefb_init(void)
 {
 	int ret = platform_driver_register(&gbefb_driver);
-	if (!ret) {
+	if (IS_ENABLED(CONFIG_SGI_IP32) && !ret) {
 		gbefb_device = platform_device_alloc("gbefb", 0);
 		if (gbefb_device) {
 			ret = platform_device_add(gbefb_device);
Signature · 1 line
2.20.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch