linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ide: ide_port_wait_ready() fix
Date: Thu, 13 Oct 2011 12:41:04 +0200	[thread overview]
Message-ID: <201110131241.04759.bzolnier@gmail.com> (raw)
In-Reply-To: <20111012.150349.1115347260310770962.davem@davemloft.net>

David Miller wrote:

> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Date: Wed, 12 Oct 2011 16:59:55 +0200
> 
> > David Miller wrote:
> > 
> >> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >> Date: Tue, 11 Oct 2011 19:13:18 +0200
> >> 
> >> > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >> > Subject: [PATCH] ide: ide_port_wait_ready() fix
> >> > 
> >> > Fix for commit a20b2a4 ("ide: skip probe if there are no devices on
> >> > the port (v2)").  We must check for slave device before failing.
> >> > 
> >> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >> 
> >> This will mishandle the case where there is no slave in the device
> >> list.
> > 
> > I don't see it:
> > 
> > @ -598,7 +598,7 @@ static int ide_port_wait_ready(ide_hwif_
> >  {
> >  	const struct ide_tp_ops *tp_ops = hwif->tp_ops;
> >  	ide_drive_t *drive;
> > -	int i, rc;
> > +	int i, rc, prev_rc = 0;
> >  
> >  	printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name);
> >  
> > @@ -623,8 +623,10 @@ static int ide_port_wait_ready(ide_hwif_
> >  			tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
> >  			mdelay(2);
> >  			rc = ide_wait_not_busy(hwif, 35000);
> > -			if (rc)
> > +			if (prev_rc && rc)
> >  				goto out;
> > +			prev_rc = rc;
> > +			rc = 0;
> >  		} else
> >  			printk(KERN_DEBUG "%s: ide_wait_not_busy() skipped\n",
> >  					  drive->name);
> > 
> > If there is no slave device but there is a master device the code falls-through
> > and returns a success.
> 
> That's not what we want, if there is only a master device and no slave device
> in the list this loop is iterating over we want to return the error code
> in "rc", not zero.

No, we want to return zero (success) since at least once device was found
(otherwise we fail probe on some esoteric setups returning -ENODEV from
ide_wait_not_busy() for master device).

This is how this function worked before commit a20b2a4 if you want something
else okay but it needs to work with aforementioned setups.

  reply	other threads:[~2011-10-13 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 17:13 [PATCH] ide: ide_port_wait_ready() fix Bartlomiej Zolnierkiewicz
2011-10-11 19:17 ` David Miller
2011-10-12 14:59   ` Bartlomiej Zolnierkiewicz
2011-10-12 19:03     ` David Miller
2011-10-13 10:41       ` Bartlomiej Zolnierkiewicz [this message]
2011-10-13 17:25         ` David Miller
2011-10-13 17:44           ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110131241.04759.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).