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

Commit 0706efd6 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

pata_jmicron: fix disabled port handling in jmicron_pre_reset()



There are two bugs in disabled port handling.

* test in PORT_PATA0 is reversed
* ->prereset should return -ENOENT for disabled ports not 0

The first bug makes the PATA channel considered disabled but the
second bug saves the day by returning 0.  The net result is that cable
is always left at ATA_CBL_UNKNOWN.  This results in false 80c
configuration and thus transfer errors.

This patch fixes both bugs.

Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent dd05c199
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -80,11 +80,10 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
	 *	actually do our cable checking etc. Thankfully we don't need
	 *	actually do our cable checking etc. Thankfully we don't need
	 *	to do the plumbing for other cases.
	 *	to do the plumbing for other cases.
	 */
	 */
	switch (port_map[port])
	switch (port_map[port]) {
	{
	case PORT_PATA0:
	case PORT_PATA0:
		if (control & (1 << 5))
		if ((control & (1 << 5)) == 0)
			return 0;
			return -ENOENT;
		if (control & (1 << 3))	/* 40/80 pin primary */
		if (control & (1 << 3))	/* 40/80 pin primary */
			ap->cbl = ATA_CBL_PATA40;
			ap->cbl = ATA_CBL_PATA40;
		else
		else
@@ -93,7 +92,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
	case PORT_PATA1:
	case PORT_PATA1:
		/* Bit 21 is set if the port is enabled */
		/* Bit 21 is set if the port is enabled */
		if ((control5 & (1 << 21)) == 0)
		if ((control5 & (1 << 21)) == 0)
			return 0;
			return -ENOENT;
		if (control5 & (1 << 19))	/* 40/80 pin secondary */
		if (control5 & (1 << 19))	/* 40/80 pin secondary */
			ap->cbl = ATA_CBL_PATA40;
			ap->cbl = ATA_CBL_PATA40;
		else
		else