]> err.no Git - linux-2.6/commitdiff
i2c-pca-isa: Add access check to legacy ioports
authorChristian Krafft <krafft@de.ibm.com>
Sun, 24 Feb 2008 19:03:42 +0000 (20:03 +0100)
committerJean Delvare <khali@hyperion.delvare>
Sun, 24 Feb 2008 19:03:42 +0000 (20:03 +0100)
When probing i2c-pca-isa writes to legacy ioports, which crashes the kernel
if there is no device at that port.
This patch adds a check_legacy_ioport call, so probe fails gracefully
and thus prevents the oops.

Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/busses/i2c-pca-isa.c

index 5161aaf9341b5049bfee9255d54a324bcb54ee01..496ee875eb4f2ffa67933abc23da2d2814205633 100644 (file)
@@ -125,6 +125,13 @@ static int __devinit pca_isa_probe(struct device *dev, unsigned int id)
 
        dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq);
 
+#ifdef CONFIG_PPC_MERGE
+       if (check_legacy_ioport(base)) {
+               dev_err(dev, "I/O address %#08lx is not available\n", base);
+               goto out;
+       }
+#endif
+
        if (!request_region(base, IO_SIZE, "i2c-pca-isa")) {
                dev_err(dev, "I/O address %#08lx is in use\n", base);
                goto out;