All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Vasily Tarasov <sectorsize512@gmail.com>
Cc: davem@davemloft.net, linux-ide@vger.kernel.org
Subject: Re: [PATCH] ide: no need to check for the rq pointer to be NULL
Date: Mon, 10 Jan 2011 15:25:47 +0300	[thread overview]
Message-ID: <4D2AFACB.3040909@ru.mvista.com> (raw)
In-Reply-To: <20110109235146.GA5353@white.fsl.cs.sunysb.edu>

Hello.

On 10-01-2011 2:51, Vasily Tarasov wrote:

> From: Vasily Tarasov<sectorsize512@gmail.com>

> No need to check for the rq pointer to be NULL before calling
> blk_fetch_request().  First we call it, then we test the pointer that it
> returns.

> Signed-off-by: Vasily Tarasov<sectorsize512@gmail.com>

    I'm not feeling sure about this patch...

> --- linux-2.6.37/drivers/ide/ide-io.c.orig	2011-01-04 19:50:19.000000000 -0500
> +++ linux-2.6.37/drivers/ide/ide-io.c	2011-01-09 18:15:44.000000000 -0500
> @@ -438,7 +438,7 @@ void do_ide_request(struct request_queue
>   	ide_drive_t	*drive = q->queuedata;
>   	ide_hwif_t	*hwif = drive->hwif;
>   	struct ide_host *host = hwif->host;
> -	struct request	*rq = NULL;
> +	struct request	*rq;
>   	ide_startstop_t	startstop;
>
>   	spin_unlock_irq(q->queue_lock);
> @@ -485,16 +485,13 @@ repeat:
>
>   		spin_unlock_irq(&hwif->lock);
>   		spin_lock_irq(q->queue_lock);
> +		rq = blk_fetch_request(drive->queue);
> +		spin_unlock_irq(q->queue_lock);
> +		spin_lock_irq(&hwif->lock);
>   		/*
>   		 * we know that the queue isn't empty, but this can happen
>   		 * if the q->prep_rq_fn() decides to kill a request
>   		 */
> -		if (!rq)
> -			rq = blk_fetch_request(drive->queue);

    Did you consider the scenario where the 'goto' is taken at the end of this 
*if* branch? 'rq' is non-NULL then...

> -
> -		spin_unlock_irq(q->queue_lock);
> -		spin_lock_irq(&hwif->lock);
> -
>   		if (!rq) {
>   			ide_unlock_port(hwif);
>   			goto out;

WBR, Sergei

  reply	other threads:[~2011-01-10 12:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-09 23:51 [PATCH] ide: no need to check for the rq pointer to be NULL Vasily Tarasov
2011-01-10 12:25 ` Sergei Shtylyov [this message]
2011-01-10 17:30   ` Vasily Tarasov
2011-01-10 18:03     ` Sergei Shtylyov

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=4D2AFACB.3040909@ru.mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=davem@davemloft.net \
    --cc=linux-ide@vger.kernel.org \
    --cc=sectorsize512@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.