summaryrefslogtreecommitdiff
path: root/sys/dev/fdt/simplefb.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/fdt/simplefb.c')
-rw-r--r--sys/dev/fdt/simplefb.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/fdt/simplefb.c b/sys/dev/fdt/simplefb.c
index 5436bea9098..5f911d74a45 100644
--- a/sys/dev/fdt/simplefb.c
+++ b/sys/dev/fdt/simplefb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: simplefb.c,v 1.7 2019/12/25 11:42:05 jsg Exp $ */
+/* $OpenBSD: simplefb.c,v 1.8 2020/01/22 05:25:05 patrick Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
*
@@ -110,8 +110,12 @@ simplefb_match(struct device *parent, void *match, void *aux)
{
struct fdt_attach_args *faa = aux;
+ /* Don't attach if it has no address space. */
+ if (faa->fa_nreg < 1 || faa->fa_reg[0].size == 0)
+ return 0;
+
/* Don't attach if another driver already claimed our framebuffer. */
- if (faa->fa_nreg > 0 && rasops_check_framebuffer(faa->fa_reg[0].addr))
+ if (rasops_check_framebuffer(faa->fa_reg[0].addr))
return 0;
return OF_is_compatible(faa->fa_node, "simple-framebuffer");
@@ -128,9 +132,6 @@ simplefb_attach(struct device *parent, struct device *self, void *aux)
int console = 0;
long defattr;
- if (faa->fa_nreg < 1)
- return;
-
format = simplefb_init(faa->fa_node, ri);
if (format) {
printf(": unsupported format \"%s\"\n", format);