Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86b37860 authored by Christoph Lameter's avatar Christoph Lameter Committed by Linus Torvalds
Browse files

[PATCH] Fix ide-disk.c oops caused by hwif == NULL



1. Move hwif_to_node to ide.h

2. Use hwif_to_node in ide-disk.c

Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent aeb3f763
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;

+0 −9
Original line number Diff line number Diff line
@@ -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
 */
+6 −0
Original line number Diff line number Diff line
@@ -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 */