From 02329a7d552bb916750d4527d87a42a53c89f8bd Mon Sep 17 00:00:00 2001 From: none Date: Tue, 31 Mar 2020 16:38:49 +0200 Subject: [PATCH] check if link exists --- ddbridge/ddbridge-io.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ddbridge/ddbridge-io.c b/ddbridge/ddbridge-io.c index 6792180..4c696f3 100644 --- a/ddbridge/ddbridge-io.c +++ b/ddbridge/ddbridge-io.c @@ -65,6 +65,8 @@ u32 ddbreadl(struct ddb *dev, u32 adr) u32 val, l = (adr >> DDB_LINK_SHIFT) & 3; struct ddb_link *link = &dev->link[l]; + if (!link->regs) + return 0; spin_lock_irqsave(&link->lock, flags); gtlw(link); ddblwritel0(link, adr & 0xfffc, link->regs + 0x14); @@ -84,6 +86,8 @@ void ddbwritel(struct ddb *dev, u32 val, u32 adr) u32 l = (adr >> DDB_LINK_SHIFT); struct ddb_link *link = &dev->link[l]; + if (!link->regs) + return; spin_lock_irqsave(&link->lock, flags); gtlw(link); ddblwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14);