Possible bug in IRQ handling in pata_of_platform / pata_platform
Steven A. Falco
sfalco at harris.com
Tue Aug 12 00:48:50 EST 2008
I think there is a bug in the communications between pata_of_platform
and pata_platform. I will refer to the master branch of the DENX git
tree, which is roughly v2.6.26.1 at this time. I am using a Sequoia
board with a PPC440EPx.
In pata_of_platform, we have:
ret = of_irq_to_resource(dn, 0, &irq_res);
if (ret == NO_IRQ)
irq_res.start = irq_res.end = -1;
so if there is no interrupt defined, then start and end are -1.
However, __pata_platform_probe has:
if (irq_res && irq_res->start > 0) {
irq = irq_res->start;
irq_flags = irq_res->flags;
}
You might think that the (irq_res->start > 0) test will fail, as it
should in this no-irq case. But, start is a u64, so the -1 actually
looks like a large positive number in the comparison. So,
__pata_platform_probe attempts to use an interrupt when there isn't one.
I think the fix would be to change __pata_platform_probe to:
if (irq_res && irq_res->start != -1) {
but that might have other unintended consequences, so I'll defer to
whomever knows more about the intent of this code.
Steve
More information about the Linuxppc-dev
mailing list