Skip to contentSkip to conversation

sparc64: isa.c should cope with OBP nodes with no "reg" property

PATCH In review [email protected] 2 participants 4 messages Dec 23, 2006 – Dec 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc64: isa.c should cope with OBP nodes with no "reg" property

From: Richard Mortimer <[email protected]>

The todm5819 Openboot device node on Netra X1 does not have a "reg" property. In this case of_get_property returns NULL resulting in an Oops. Avoid this by returning from isa_dev_get_resource() without attempting to request_resource().

---
 arch/sparc64/kernel/isa.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/sparc64/kernel/isa.c +4 -0
index ad1c4f5..cb556f0 100644
@@ -31,6 +31,10 @@ isa_dev_get_resource(struct sparc_isa_device *isa_dev)
 
 	pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len);
 
+	if (!pregs) {
+		return NULL;
+	}
+
 	/* Only the first one is interesting. */
 	len = pregs[0].reg_size;
 	base = (((unsigned long)pregs[0].which_io << 32) |
Signature · 1 line
1.4.4.2
#1 lore raw

Re: [PATCH] sparc64: isa.c should cope with OBP nodes with no

From: [email protected]
Date: Sat, 23 Dec 2006 23:07:25 +0000

Quoted 8 lines

From: Richard Mortimer <[email protected]>

The todm5819 Openboot device node on Netra X1 does not have a "reg" property. In this case of_get_property returns NULL resulting in an Oops. Avoid this by returning from isa_dev_get_resource() without attempting to request_resource().

Thanks for catching this.

It's really aweful how we return the "pregs" here but it's ultimately unused, because even though we end up passing it to isa_dev_get_irq() that function doesn't even use the pregs argument.

So let's just return void from isa_dev_get_resource() and drop the pregs arg from isa_dev_get_irq().

I'll apply the following as ths fix, thanks again.

#2 lore raw

Re: [PATCH] sparc64: isa.c should cope with OBP nodes with no

In reply to [email protected]
Quoted 19 lines · David Miller

From: [email protected]
Date: Sat, 23 Dec 2006 23:07:25 +0000

Quoted 8 lines

From: Richard Mortimer <[email protected]>

The todm5819 Openboot device node on Netra X1 does not have a "reg" property. In this case of_get_property returns NULL resulting in an Oops. Avoid this by returning from isa_dev_get_resource() without attempting to request_resource().

Thanks for catching this.

It's really aweful how we return the "pregs" here but it's ultimately unused, because even though we end up passing it to isa_dev_get_irq() that function doesn't even use the pregs argument.

Quoted 5 lines

So let's just return void from isa_dev_get_resource() and drop the pregs arg from isa_dev_get_irq().

I'll apply the following as ths fix, thanks again.

Hi David,

I didn't get a fix with this mail and cannot see any on your git trees on kernel.org (then again I may have been looking at the wrong ones).

As far as the fix is concerned I did originally send you two patches. The first was the fix for the problem and the second cleaned up the pregs issue. Not that it bothers me. I'm happy if the kernel boots :-)

Richard

Signature · 1 line
Richard Mortimer <[email protected]>
#3 lore raw

Re: [PATCH] sparc64: isa.c should cope with OBP nodes with no

In reply to [email protected]

From: Richard Mortimer <[email protected]>
Date: Fri, 29 Dec 2006 22:47:25 +0000

Quoted 2 lines

I didn't get a fix with this mail and cannot see any on your git trees on kernel.org (then again I may have been looking at the wrong ones).

I forgot to push last night before going to bed, sorry :-)

I did just push to my sparc-2.6.git tree, so it should show up on the mirrors soon.

Quoted 3 lines

As far as the fix is concerned I did originally send you two patches. The first was the fix for the problem and the second cleaned up the pregs issue. Not that it bothers me. I'm happy if the kernel boots :-)

Aha, indeed!

I'll push the fix to the 2.6.x -stable branches as well.