From patchwork Fri Apr 23 07:01:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 50791 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 80600B6F11 for ; Fri, 23 Apr 2010 17:01:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756096Ab0DWHBm (ORCPT ); Fri, 23 Apr 2010 03:01:42 -0400 Received: from hera.kernel.org ([140.211.167.34]:47202 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756092Ab0DWHBl (ORCPT ); Fri, 23 Apr 2010 03:01:41 -0400 Received: from htj.dyndns.org (localhost [127.0.0.1]) by hera.kernel.org (8.14.3/8.14.3) with ESMTP id o3N714O9010949 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 23 Apr 2010 07:01:06 GMT X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.95.2 at hera.kernel.org Received: from [127.0.0.2] (htj.dyndns.org [127.0.0.2]) by htj.dyndns.org (Postfix) with ESMTPSA id B52CA1004B010; Fri, 23 Apr 2010 09:01:04 +0200 (CEST) Message-ID: <4BD145B0.8080102@kernel.org> Date: Fri, 23 Apr 2010 09:01:04 +0200 From: Tejun Heo User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Jeff Garzik CC: Fang Wenqi , linux-ide@vger.kernel.org, Alan Cox , antonf@turbolinux.com.cn Subject: Re: [PATCH] drivers/ata/libata-eh.c: fix unused variable warning References: <1271858846-1706-1-git-send-email-antonf@turbolinux.com.cn> <20100421152404.62699040@lxorguk.ukuu.org.uk> <4BCF1247.8080508@gmail.com> <4BCFA50E.80800@gmail.com> <4BD13E84.2040204@kernel.org> <20100423064332.GA22988@shell.devel.redhat.com> In-Reply-To: <20100423064332.GA22988@shell.devel.redhat.com> X-Spam-Status: No, score=0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (hera.kernel.org [127.0.0.1]); Fri, 23 Apr 2010 07:01:06 +0000 (UTC) Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Hello, Jeff. On 04/23/2010 08:43 AM, Jeff Garzik wrote: > On Fri, Apr 23, 2010 at 08:30:28AM +0200, Tejun Heo wrote: >> On 04/22/2010 03:23 AM, Fang Wenqi wrote: >>> Sorry that the title should be: >>> "fix uninitialized variable warning" >>> >>> not >>> "fix unused variable warning" >>> >>> Need I re-send the patch mail ? >> >> Yes, please do so. gcc 4.4.1 generates a spurious warning on it too. >> >> Acked-by: Tejun Heo > > It's not a spurious warning. The code failed to fully initialize all > fields of the ata_taskfile structure, prior to copying the ata_taskfile > structure into qc->result_tf. Hmmmm.... right, I've always thought it was gcc not noticing the structure is being initialized in ata_eh_read_log_10h() but it actually is noticing much more, so something like the following is more appropriate? Subject: libata: fully initialize @tf in ata_eh_read_log_10h() ata_eh_read_log_10h() filled @tf only partially. It didn't cause any correctness issues but triggered spruious uninitialized variable warning. Do ata_tf_init() before filling in @tf. Signed-off-by: Tejun Heo --- drivers/ata/libata-eh.c | 1 + 1 file changed, 1 insertion(+) -- 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 diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 9f6cfac..fa7e902 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -1434,6 +1434,7 @@ static int ata_eh_read_log_10h(struct ata_device *dev, *tag = buf[0] & 0x1f; + ata_tf_init(dev, tf); tf->command = buf[2]; tf->feature = buf[3]; tf->lbal = buf[4];