Message ID | 1276547208-26569-5-git-send-email-justinmattock@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers |
Return-path: <linux-media-owner@vger.kernel.org> Envelope-to: mchehab@infradead.org Delivery-date: Mon, 14 Jun 2010 20:29:26 +0000 Received: from bombadil.infradead.org [18.85.46.34] by localhost with IMAP (fetchmail-6.3.17) for <mchehab@localhost> (single-drop); Tue, 15 Jun 2010 07:59:48 +0300 (EEST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1OOGHd-00053T-QW; Mon, 14 Jun 2010 20:29:26 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756005Ab0FNU2M (ORCPT <rfc822; kmpark@infradead.org> + 1 other); Mon, 14 Jun 2010 16:28:12 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:52855 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755745Ab0FNU04 (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 14 Jun 2010 16:26:56 -0400 Received: by pvg16 with SMTP id 16so3067678pvg.19 for <multiple recipients>; Mon, 14 Jun 2010 13:26:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=vAeEAVPIC+JLLL7ucMt7CmWsP4mdHL9Ud3pHB7ZWL3M=; b=ZIpBUDfS2v7cvoXK0TnEykNo0U936r4kPdwBUYLtgGrVQeQQcwe46yeENuYzZ7YazY VYkl5lFi67riFp/rI1j6OJXUuJA4Nto7NSGfqE9G1WkibEnyWks2BwF7xP0BoBk6oABJ W42GhWOujFDH2UWW+23c/uVpB1RefNsgGQT+U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=balXRRKzb2RoRnlc+ZIqG18EC6+Ie4O92chpRmZuqk8qmcGRbqQVrEnv8BPvh+7Agd pnQp1W01sO39aFTsNI07NlDQeTOxiSIUzyzdTggY7ThyFgCaaR1H9mqbhO8TcP4K0G1c eFl7bGhztRvBMXNfNYqb3IJEj3t9qeCjl9F7U= Received: by 10.115.102.16 with SMTP id e16mr4917321wam.117.1276547215544; Mon, 14 Jun 2010 13:26:55 -0700 (PDT) Received: from localhost.localdomain ([76.91.45.220]) by mx.google.com with ESMTPS id r20sm58982854wam.5.2010.06.14.13.26.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 14 Jun 2010 13:26:55 -0700 (PDT) From: "Justin P. Mattock" <justinmattock@gmail.com> To: linux-kernel@vger.kernel.org Cc: reiserfs-devel@vger.kernel.org, linux-bluetooth@vger.kernel.org, clemens@ladisch.de, debora@linux.vnet.ibm.com, dri-devel@lists.freedesktop.org, linux-i2c@vger.kernel.org, linux1394-devel@lists.sourceforge.net, linux-media@vger.kernel.org, "Justin P. Mattock" <justinmattock@gmail.com> Subject: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used Date: Mon, 14 Jun 2010 13:26:44 -0700 Message-Id: <1276547208-26569-5-git-send-email-justinmattock@gmail.com> X-Mailer: git-send-email 1.7.1.rc1.21.gf3bd6 In-Reply-To: <1276547208-26569-1-git-send-email-justinmattock@gmail.com> References: <1276547208-26569-1-git-send-email-justinmattock@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Justin P. Mattock
June 14, 2010, 8:26 p.m. UTC
Im getting this warning when compiling:
CC drivers/char/tpm/tpm.o
drivers/char/tpm/tpm.c: In function 'tpm_gen_interrupt':
drivers/char/tpm/tpm.c:508:10: warning: variable 'rc' set but not used
The below patch gets rid of the warning,
but I'm not sure if it's the best solution.
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
---
drivers/char/tpm/tpm.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
Comments
On Mon, 14 Jun 2010 13:26:44 PDT, "Justin P. Mattock" said: > Im getting this warning when compiling: > CC drivers/char/tpm/tpm.o > drivers/char/tpm/tpm.c: In function 'tpm_gen_interrupt': > drivers/char/tpm/tpm.c:508:10: warning: variable 'rc' set but not used > > The below patch gets rid of the warning, > but I'm not sure if it's the best solution. > rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, > "attempting to determine the timeouts"); > + if (!rc) > + rc = 0; > } Good thing that's a void function. ;) Unless transmit_cmd() is marked 'must_check', maybe losing the 'rc =' would be a better solution?
On 06/14/2010 05:13 PM, Valdis.Kletnieks@vt.edu wrote: > On Mon, 14 Jun 2010 13:26:44 PDT, "Justin P. Mattock" said: >> Im getting this warning when compiling: >> CC drivers/char/tpm/tpm.o >> drivers/char/tpm/tpm.c: In function 'tpm_gen_interrupt': >> drivers/char/tpm/tpm.c:508:10: warning: variable 'rc' set but not used >> >> The below patch gets rid of the warning, >> but I'm not sure if it's the best solution. > >> rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE, >> "attempting to determine the timeouts"); >> + if (!rc) >> + rc = 0; >> } > > Good thing that's a void function. ;) > > Unless transmit_cmd() is marked 'must_check', maybe losing the 'rc =' would > be a better solution? what I tried was this: if (!rc) printk("test........"\n") and everything looked good, but as a soon as I changed rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE, "attempting to determine the timeouts"); to this: rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE); if (!rc) printk("attempting to determine the timeouts\n"); I error out with transmit_cmd not having enough functions to it.. so I just added the rc = 0; and went on to the next. Justin P. Mattock -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 14 Jun 2010 19:12:31 PDT, "Justin P. Mattock" said: > what I tried was this: > > if (!rc) > printk("test........"\n") > > and everything looked good, > but as a soon as I changed > > rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE, > "attempting to determine the timeouts"); > > to this: > > rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE); > > if (!rc) > printk("attempting to determine the timeouts\n"); *baffled* Why did you think that would work? transmit_cmd()s signature has 4 parameters.
On 06/14/2010 08:49 PM, Valdis.Kletnieks@vt.edu wrote: > On Mon, 14 Jun 2010 19:12:31 PDT, "Justin P. Mattock" said: > >> what I tried was this: >> >> if (!rc) >> printk("test........"\n") >> >> and everything looked good, >> but as a soon as I changed >> >> rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE, >> "attempting to determine the timeouts"); >> >> to this: >> >> rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE); >> >> if (!rc) >> printk("attempting to determine the timeouts\n"); > > *baffled* Why did you think that would work? transmit_cmd()s signature > has 4 parameters. I have no manual in front of me. Did a quick google, but came up with (no hits) info on what that function does. grep showed too many entries to really see why/what this is. So I kind of just scrambled with this one. Justin P. Mattock -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Justin P. Mattock wrote: > > *baffled* Why did you think that would work? transmit_cmd()s signature > > has 4 parameters. > > I have no manual in front of me. Did a quick google, but came up with > (no hits) info on what that function does. grep showed too many entries > to really see why/what this is. Check out the tool cscope. (Or kscope, if you prefer a GUI.) //Peter -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 06/14/2010 10:29 PM, Peter Stuge wrote: > Justin P. Mattock wrote: >>> *baffled* Why did you think that would work? transmit_cmd()s signature >>> has 4 parameters. >> >> I have no manual in front of me. Did a quick google, but came up with >> (no hits) info on what that function does. grep showed too many entries >> to really see why/what this is. > > Check out the tool cscope. (Or kscope, if you prefer a GUI.) > > > //Peter > thanks for this tool.. I think this is what I need.. running around not knowing what/where the manual is for a call is a bit daunting. I'll give this a look. Thanks for this.. Justin P. Mattock -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 15 Jun 2010 07:29:44 +0200, Peter Stuge wrote: > Justin P. Mattock wrote: > > > *baffled* Why did you think that would work? transmit_cmd()s signature > > > has 4 parameters. > > > > I have no manual in front of me. Did a quick google, but came up with > > (no hits) info on what that function does. grep showed too many entries > > to really see why/what this is. Justin, I think you're on the wrong track here. You seem to be in a hurry to fix all these warnings generated by gcc 4.6. There is no hurry at all. Most warnings are false positives, and actual bugs may take some thinking and knowledge. So rushing is not needed and not desirable. Going too fast, you might even introduce new bugs, or prevent old bugs from being properly fixed. Warnings are a chance to make the code better. The goal is not to fix them quickly, but to fix them properly. If this is not your intent, then please stop immediately and let others deal with these warnings. If you want to help, this is appreciated, but what we need it quality, not quantity. > Check out the tool cscope. (Or kscope, if you prefer a GUI.) Or just LXR online if you don't want to install anything: http://lxr.linux.no/linux http://lxr.linux.no/#linux+v2.6.34/drivers/char/tpm/tpm.c#L451
On 06/15/2010 02:19 AM, Jean Delvare wrote: > On Tue, 15 Jun 2010 07:29:44 +0200, Peter Stuge wrote: >> Justin P. Mattock wrote: >>>> *baffled* Why did you think that would work? transmit_cmd()s signature >>>> has 4 parameters. >>> >>> I have no manual in front of me. Did a quick google, but came up with >>> (no hits) info on what that function does. grep showed too many entries >>> to really see why/what this is. > > Justin, I think you're on the wrong track here. You seem to be in a > hurry to fix all these warnings generated by gcc 4.6. There is no hurry > at all. Most warnings are false positives, and actual bugs may take > some thinking and knowledge. So rushing is not needed and not > desirable. Going too fast, you might even introduce new bugs, or > prevent old bugs from being properly fixed. > > Warnings are a chance to make the code better. The goal is not to fix > them quickly, but to fix them properly. If this is not your intent, > then please stop immediately and let others deal with these warnings. > If you want to help, this is appreciated, but what we need it quality, > not quantity. > your right.. I do have this "must get it fixed now, or else cut your head of mentality".. causing me to rush through things.. who knows why I do this..(I dont know why I do this honestly) >> Check out the tool cscope. (Or kscope, if you prefer a GUI.) > > Or just LXR online if you don't want to install anything: > > http://lxr.linux.no/linux > http://lxr.linux.no/#linux+v2.6.34/drivers/char/tpm/tpm.c#L451 > At this point though gentlemen/ladies I'm pretty much crapped out now!! so any answer is going to be skewed. but rushing through things is not good. Justin P. Mattock -- To unsubscribe from this list: send the line "unsubscribe linux-media" 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/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 05ad4a1..3d685dc 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -514,6 +514,8 @@ void tpm_gen_interrupt(struct tpm_chip *chip) rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, "attempting to determine the timeouts"); + if (!rc) + rc = 0; } EXPORT_SYMBOL_GPL(tpm_gen_interrupt);