PNP: make pnp_{port,mem,etc}_start(), et al work for invalid resources
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Fri, 27 Jun 2008 22:56:56 +0000 (16:56 -0600)
committerAndi Kleen <andi@basil.nowhere.org>
Wed, 16 Jul 2008 21:27:05 +0000 (23:27 +0200)
commit20bfdbba7212d19613b93dcea93f26cb65af91fe
treeae75729ddb1cb82931d740fd6a812f295749f706
parent9fdee4e02e3b214cde8e4f3beb6776075a3d08a7
PNP: make pnp_{port,mem,etc}_start(), et al work for invalid resources

Some callers use pnp_port_start() and similar functions without
making sure the resource is valid.  This patch makes us fall
back to returning the initial values if the resource is not
valid or not even present.

This mostly preserves the previous behavior, where we would just
return the initial values set by pnp_init_resource_table().  The
original 2.6.25 code didn't range-check the "bar", so it would
return garbage if the bar exceeded the table size.  This code
returns sensible values instead.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
include/linux/pnp.h