From patchwork Sun Jan 9 23:51:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Tarasov X-Patchwork-Id: 78063 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 84ADDB6F14 for ; Mon, 10 Jan 2011 10:51:55 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753177Ab1AIXvy (ORCPT ); Sun, 9 Jan 2011 18:51:54 -0500 Received: from mail-qy0-f174.google.com ([209.85.216.174]:56167 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144Ab1AIXvx (ORCPT ); Sun, 9 Jan 2011 18:51:53 -0500 Received: by qyj19 with SMTP id 19so1103140qyj.19 for ; Sun, 09 Jan 2011 15:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=CA14vrSOw2PiQHT3jctylUtbKeEq0VZV5do/BxgchZE=; b=r4QXK1jqc3NCKU/M9C38ZO0sXrXyqQpOhzkDRsxeUDSIiXd4JPquyA0AD2uIgbLtcQ gU6uZGBRUz6f0SFOMYATnHPme+DfcCs/EdWrZ3II7MO+3ZK4B0xdpGla1Zczgvt6czls YeFLTmDbdAK+MlzPJMN0svpsn9KwOK5q77+B0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=RUo5K/KhnEN/dsa/OeHXFxEqCoP5AuaX5ZrHw7nyPOqRZmQcP8L1KN9mDvxPZE0m4d HM/FlqVAJOVtal2vZddnmFR4sra3CEpCCsd0ft/vEZsG1UDtjoyggQy8KXX6C9Cs3Qxm P1efZE+xrqfgAHgZMo/xsTF9d1Xj1b+YHzVJM= Received: by 10.229.215.9 with SMTP id hc9mr7840844qcb.117.1294617113068; Sun, 09 Jan 2011 15:51:53 -0800 (PST) Received: from white.fsl.cs.sunysb.edu (white.fsl.cs.sunysb.edu [130.245.126.113]) by mx.google.com with ESMTPS id l12sm16994888qcu.7.2011.01.09.15.51.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 09 Jan 2011 15:51:52 -0800 (PST) Date: Sun, 9 Jan 2011 18:51:46 -0500 From: Vasily Tarasov To: davem@davemloft.net Cc: linux-ide@vger.kernel.org Subject: [PATCH] ide: no need to check for the rq pointer to be NULL Message-ID: <20110109235146.GA5353@white.fsl.cs.sunysb.edu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Vasily Tarasov 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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); - - spin_unlock_irq(q->queue_lock); - spin_lock_irq(&hwif->lock); - if (!rq) { ide_unlock_port(hwif); goto out;