Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210921212102.30803-1-broonie@kernel.org
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

authored by

Mark Brown and committed by
Maarten Lankhorst
11b8e2bb ec7cc3f7

+1 -1
+1 -1
drivers/video/fbdev/gbefb.c
··· 1267 1267 static int __init gbefb_init(void) 1268 1268 { 1269 1269 int ret = platform_driver_register(&gbefb_driver); 1270 - if (!ret) { 1270 + if (IS_ENABLED(CONFIG_SGI_IP32) && !ret) { 1271 1271 gbefb_device = platform_device_alloc("gbefb", 0); 1272 1272 if (gbefb_device) { 1273 1273 ret = platform_device_add(gbefb_device);