From patchwork Mon Jun 22 19:10:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 29015 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.176.167]) by bilbo.ozlabs.org (Postfix) with ESMTP id 68EB2B712D for ; Tue, 23 Jun 2009 05:11:08 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751631AbZFVTLD (ORCPT ); Mon, 22 Jun 2009 15:11:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751935AbZFVTLD (ORCPT ); Mon, 22 Jun 2009 15:11:03 -0400 Received: from zone0.gcu-squad.org ([212.85.147.21]:5991 "EHLO services.gcu-squad.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751631AbZFVTLB (ORCPT ); Mon, 22 Jun 2009 15:11:01 -0400 Received: from jdelvare.pck.nerim.net ([62.212.121.182] helo=hyperion.delvare) by services.gcu-squad.org (GCU Mailer Daemon) with esmtpsa id 1MIq1z-0005LV-1M (TLSv1:AES256-SHA:256) (envelope-from ) ; Mon, 22 Jun 2009 22:22:19 +0200 Date: Mon, 22 Jun 2009 21:10:52 +0200 From: Jean Delvare To: Bartlomiej Zolnierkiewicz , linux-ide@vger.kernel.org Subject: [PATCH] IDE: Silent compiler warning in ide_pio_bytes() Message-ID: <20090622211052.45b3cfc5@hyperion.delvare> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.14.4; i586-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org PageHighMem() isn't cheap so avoid calling it several times on the same page. I had the hope that this would silent the following compilation warning: drivers/ide/ide-taskfile.c: In function 'ide_pio_bytes': drivers/ide/ide-taskfile.c:229: warning: 'flags' may be used uninitialized in this function which is a false positive, but it did not. So let's just initialize the flags and be done with it, so that other developers don't waste their time looking at it. Signed-off-by: Jean Delvare Cc: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- linux-2.6.31-pre.orig/drivers/ide/ide-taskfile.c 2009-06-21 09:37:02.000000000 +0200 +++ linux-2.6.31-pre/drivers/ide/ide-taskfile.c 2009-06-21 12:18:47.000000000 +0200 @@ -226,7 +226,7 @@ void ide_pio_bytes(ide_drive_t *drive, s struct scatterlist *sg = hwif->sg_table; struct scatterlist *cursg = cmd->cursg; struct page *page; - unsigned long flags; + unsigned long flags = 0; /* Silent compiler warning */ unsigned int offset; u8 *buf; @@ -236,6 +236,7 @@ void ide_pio_bytes(ide_drive_t *drive, s while (len) { unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs); + int page_is_high; if (nr_bytes > PAGE_SIZE) nr_bytes = PAGE_SIZE; @@ -247,7 +248,8 @@ void ide_pio_bytes(ide_drive_t *drive, s page = nth_page(page, (offset >> PAGE_SHIFT)); offset %= PAGE_SIZE; - if (PageHighMem(page)) + page_is_high = PageHighMem(page); + if (page_is_high) local_irq_save(flags); buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; @@ -268,7 +270,7 @@ void ide_pio_bytes(ide_drive_t *drive, s kunmap_atomic(buf, KM_BIO_SRC_IRQ); - if (PageHighMem(page)) + if (page_is_high) local_irq_restore(flags); len -= nr_bytes;