All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: fbdev: gbefb: Only instantiate device when built for IP32
@ 2021-09-21 21:21 Mark Brown
  2021-09-30 14:15 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2021-09-21 21:21 UTC (permalink / raw)
  To: Thomas Zimmermann, Sam Ravnborg
  Cc: dri-devel, linux-fbdev, Mark Brown, Bartlomiej Zolnierkiewicz

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>
---
 drivers/video/fbdev/gbefb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c
index c5b99a4861e8..6b4d5a7f3e15 100644
--- a/drivers/video/fbdev/gbefb.c
+++ b/drivers/video/fbdev/gbefb.c
@@ -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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] video: fbdev: gbefb: Only instantiate device when built for IP32
  2021-09-21 21:21 [PATCH] video: fbdev: gbefb: Only instantiate device when built for IP32 Mark Brown
@ 2021-09-30 14:15 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2021-09-30 14:15 UTC (permalink / raw)
  To: Mark Brown
  Cc: Thomas Zimmermann, Sam Ravnborg, dri-devel, linux-fbdev,
	Bartlomiej Zolnierkiewicz

On Tue, Sep 21, 2021 at 10:21:02PM +0100, Mark Brown wrote:
> 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>

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

> ---
>  drivers/video/fbdev/gbefb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c
> index c5b99a4861e8..6b4d5a7f3e15 100644
> --- a/drivers/video/fbdev/gbefb.c
> +++ b/drivers/video/fbdev/gbefb.c
> @@ -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);
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-30 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 21:21 [PATCH] video: fbdev: gbefb: Only instantiate device when built for IP32 Mark Brown
2021-09-30 14:15 ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.