]> err.no Git - linux-2.6/commitdiff
[PATCH] Fix ide-disk.c oops caused by hwif == NULL
authorChristoph Lameter <christoph@lameter.com>
Wed, 10 Aug 2005 02:59:21 +0000 (19:59 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 10 Aug 2005 03:21:31 +0000 (20:21 -0700)
1. Move hwif_to_node to ide.h

2. Use hwif_to_node in ide-disk.c

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/ide/ide-disk.c
drivers/ide/ide-probe.c
include/linux/ide.h

index f9c1acb4ed6a438c5518a22de4697aa13c88a3ee..c9d3a00a3c0c643bedcefd299d41d9075a08c036 100644 (file)
@@ -1220,7 +1220,7 @@ static int ide_disk_probe(struct device *dev)
                goto failed;
 
        g = alloc_disk_node(1 << PARTN_BITS,
-                       pcibus_to_node(drive->hwif->pci_dev->bus));
+                       hwif_to_node(drive->hwif));
        if (!g)
                goto out_free_idkp;
 
index 94daf40ae323300b5bc68fdd58697dbd9916453a..c1128ae5cd2f98319ee889b74fefd7e69916edd4 100644 (file)
@@ -960,15 +960,6 @@ static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
 }
 #endif /* MAX_HWIFS > 1 */
 
-static inline int hwif_to_node(ide_hwif_t *hwif)
-{
-       if (hwif->pci_dev)
-               return pcibus_to_node(hwif->pci_dev->bus);
-       else
-               /* Add ways to determine the node of other busses here */
-               return -1;
-}
-
 /*
  * init request queue
  */
index 92129078d4f3946d7e0af5495df920cb88cb147a..a6dbb51ecd7b780bd4659ae569fed4f2368ac2d9 100644 (file)
@@ -1501,4 +1501,10 @@ extern struct bus_type ide_bus_type;
 #define ide_id_has_flush_cache_ext(id) \
        (((id)->cfs_enable_2 & 0x2400) == 0x2400)
 
+static inline int hwif_to_node(ide_hwif_t *hwif)
+{
+       struct pci_dev *dev = hwif->pci_dev;
+       return dev ? pcibus_to_node(dev->bus) : -1;
+}
+
 #endif /* _IDE_H */