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

Commit 4f65977d authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

[PATCH] libata: make ata_set_mode() handle no-device case properly



Make ata_set_mode() return without doing anything if there is no
device on the port.  This is in preparation for ata_bus_probe()
changes.

Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent e1211e3f
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -1823,7 +1823,7 @@ static void ata_host_set_dma(struct ata_port *ap)
 */
 */
static void ata_set_mode(struct ata_port *ap)
static void ata_set_mode(struct ata_port *ap)
{
{
	int i, rc, used_dma = 0;
	int i, rc, used_dma = 0, found = 0;


	/* step 1: calculate xfer_mask */
	/* step 1: calculate xfer_mask */
	for (i = 0; i < ATA_MAX_DEVICES; i++) {
	for (i = 0; i < ATA_MAX_DEVICES; i++) {
@@ -1842,9 +1842,12 @@ static void ata_set_mode(struct ata_port *ap)
		dev->pio_mode = ata_xfer_mask2mode(pio_mask);
		dev->pio_mode = ata_xfer_mask2mode(pio_mask);
		dev->dma_mode = ata_xfer_mask2mode(dma_mask);
		dev->dma_mode = ata_xfer_mask2mode(dma_mask);


		found = 1;
		if (dev->dma_mode)
		if (dev->dma_mode)
			used_dma = 1;
			used_dma = 1;
	}
	}
	if (!found)
		return;


	/* step 2: always set host PIO timings */
	/* step 2: always set host PIO timings */
	rc = ata_host_set_pio(ap);
	rc = ata_host_set_pio(ap);