summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2020-01-22 05:25:06 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2020-01-22 05:25:06 +0000
commita108b19daafa10b882a15c1403e8c7c55950568b (patch)
tree157c99039bd8b22c9a19ccbbb6d92c90fb28cb58 /sys/dev/fdt
parentf5574f54a7656c5d531622fcf653141ae2f77c58 (diff)
The Pinebook Pro's u-boot seems to add a zero-length framebuffer
node, which essentially means that there is none. Make sure we don't attach in that case, so that we don't panic while trying to map it. ok kettenis@
Diffstat (limited to 'sys/dev/fdt')
-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);