Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-15 Thread Justin P. Mattock

On 06/15/2010 11:53 AM, Sergey V. wrote:

On Tuesday 15 of June 2010 00:26:44 Justin P. Mattock wrote:

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

---
  drivers/char/tpm/tpm.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

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);

--
1.7.1.rc1.21.gf3bd6



Hi Justin

IMHO
See code of functions tpm_transmit(), transmit_cmd and tpm_gen_interrupt().
In tpm_gen_interrupt() not need check rc for wrong value bacause if in function
transmit_cmd() len == TPM_ERROR_SIZE then put a debug message (dev_dbg()).
Again, if something wrong in tpm_transmit() then runs dev_err() and rc in
tpm_gen_interrupt() get -E* value.
So, we can remove unused rc variable in tpm_gen_interrupt().

See patch below. Note: I not tested it.


Subject: [PATCH] drivers: tpm.c: Remove unused variable 'rc'

---
  drivers/char/tpm/tpm.c |5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 05ad4a1..f9f5b47 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -505,15 +505,14 @@ ssize_t tpm_getcap(struct device *dev, __be32 subcap_id,
cap_t *cap,
  void tpm_gen_interrupt(struct tpm_chip *chip)
  {
struct  tpm_cmd_t tpm_cmd;
-   ssize_t rc;

tpm_cmd.header.in = tpm_getcap_header;
tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;

-   rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
-   "attempting to determine the timeouts");
+   transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
+"attempting to determine the timeouts");
  }
  EXPORT_SYMBOL_GPL(tpm_gen_interrupt);





o.k. applied this patch and rebuilt, here is what I see:

  CC [M]  drivers/char/ipmi/ipmi_poweroff.o
  CC  drivers/char/tpm/tpm.o
  CC  drivers/char/tpm/tpm_bios.o
  CC  drivers/char/tpm/tpm_tis.o
  LD  drivers/char/tpm/built-in.o


looks good over here Thanks for sending this..

Justin P. Mattock
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-15 Thread Sergey V.
On Tuesday 15 of June 2010 00:26:44 Justin P. Mattock wrote:
> 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 
> 
> ---
>  drivers/char/tpm/tpm.c |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> 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);
>  
> -- 
> 1.7.1.rc1.21.gf3bd6
> 

Hi Justin

IMHO
See code of functions tpm_transmit(), transmit_cmd and tpm_gen_interrupt(). 
In tpm_gen_interrupt() not need check rc for wrong value bacause if in function 
transmit_cmd() len == TPM_ERROR_SIZE then put a debug message (dev_dbg()).
Again, if something wrong in tpm_transmit() then runs dev_err() and rc in 
tpm_gen_interrupt() get -E* value.
So, we can remove unused rc variable in tpm_gen_interrupt(). 

See patch below. Note: I not tested it.


Subject: [PATCH] drivers: tpm.c: Remove unused variable 'rc'

---
 drivers/char/tpm/tpm.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 05ad4a1..f9f5b47 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -505,15 +505,14 @@ ssize_t tpm_getcap(struct device *dev, __be32 subcap_id, 
cap_t *cap,
 void tpm_gen_interrupt(struct tpm_chip *chip)
 {
struct  tpm_cmd_t tpm_cmd;
-   ssize_t rc;
 
tpm_cmd.header.in = tpm_getcap_header;
tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;
 
-   rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
-   "attempting to determine the timeouts");
+   transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
+"attempting to determine the timeouts");
 }
 EXPORT_SYMBOL_GPL(tpm_gen_interrupt);
 
-- 
1.7.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-15 Thread Sergey V.
On Tuesday 15 of June 2010 00:26:44 Justin P. Mattock wrote:
> 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 
> 
> ---
>  drivers/char/tpm/tpm.c |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> 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);
>  
> -- 
> 1.7.1.rc1.21.gf3bd6
> 

Hi Justin

IMHO
See code of functions tpm_transmit(), transmit_cmd and tpm_gen_interrupt(). 
In tpm_gen_interrupt() not need check rc for wrong value bacause if in function 
transmit_cmd() len == TPM_ERROR_SIZE then put a debug message (dev_dbg()).
Again, if something wrong in tpm_transmit() then runs dev_err() and rc in 
tpm_gen_interrupt() get -E* value.
So, we can remove unused rc variable in tpm_gen_interrupt(). 

See patch below. Note: I not tested it.


Subject: [PATCH] drivers: tpm.c: Remove unused variable 'rc'

---
 drivers/char/tpm/tpm.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 05ad4a1..f9f5b47 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -505,15 +505,14 @@ ssize_t tpm_getcap(struct device *dev, __be32 subcap_id, 
cap_t *cap,
 void tpm_gen_interrupt(struct tpm_chip *chip)
 {
struct  tpm_cmd_t tpm_cmd;
-   ssize_t rc;

tpm_cmd.header.in = tpm_getcap_header;
tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;

-   rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
-   "attempting to determine the timeouts");
+   transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
+"attempting to determine the timeouts");
 }
 EXPORT_SYMBOL_GPL(tpm_gen_interrupt);

-- 
1.7.1


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-15 Thread Justin P. Mattock
On 06/15/2010 11:53 AM, Sergey V. wrote:
> On Tuesday 15 of June 2010 00:26:44 Justin P. Mattock wrote:
>> 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
>>
>> ---
>>   drivers/char/tpm/tpm.c |2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> 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);
>>
>> --
>> 1.7.1.rc1.21.gf3bd6
>>
>
> Hi Justin
>
> IMHO
> See code of functions tpm_transmit(), transmit_cmd and tpm_gen_interrupt().
> In tpm_gen_interrupt() not need check rc for wrong value bacause if in 
> function
> transmit_cmd() len == TPM_ERROR_SIZE then put a debug message (dev_dbg()).
> Again, if something wrong in tpm_transmit() then runs dev_err() and rc in
> tpm_gen_interrupt() get -E* value.
> So, we can remove unused rc variable in tpm_gen_interrupt().
>
> See patch below. Note: I not tested it.
>
>
> Subject: [PATCH] drivers: tpm.c: Remove unused variable 'rc'
>
> ---
>   drivers/char/tpm/tpm.c |5 ++---
>   1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
> index 05ad4a1..f9f5b47 100644
> --- a/drivers/char/tpm/tpm.c
> +++ b/drivers/char/tpm/tpm.c
> @@ -505,15 +505,14 @@ ssize_t tpm_getcap(struct device *dev, __be32 subcap_id,
> cap_t *cap,
>   void tpm_gen_interrupt(struct tpm_chip *chip)
>   {
>   struct  tpm_cmd_t tpm_cmd;
> - ssize_t rc;
>
>   tpm_cmd.header.in = tpm_getcap_header;
>   tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
>   tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
>   tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;
>
> - rc = transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
> - "attempting to determine the timeouts");
> + transmit_cmd(chip,&tpm_cmd, TPM_INTERNAL_RESULT_SIZE,
> +  "attempting to determine the timeouts");
>   }
>   EXPORT_SYMBOL_GPL(tpm_gen_interrupt);
>



o.k. applied this patch and rebuilt, here is what I see:

   CC [M]  drivers/char/ipmi/ipmi_poweroff.o
   CC  drivers/char/tpm/tpm.o
   CC  drivers/char/tpm/tpm_bios.o
   CC  drivers/char/tpm/tpm_tis.o
   LD  drivers/char/tpm/built-in.o


looks good over here Thanks for sending this..

Justin P. Mattock


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-15 Thread Peter Stuge
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


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread valdis.kletni...@vt.edu
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.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: 



Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Peter Stuge
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
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock

On 06/14/2010 08:49 PM, valdis.kletni...@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
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Valdis . Kletnieks
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.


pgpsJN0XLvx3U.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Valdis . Kletnieks
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?


pgpjRfgTzM2eX.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock

On 06/14/2010 05:13 PM, valdis.kletni...@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
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock

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
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock
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


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock
On 06/14/2010 08:49 PM, Valdis.Kletnieks at 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


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread valdis.kletni...@vt.edu
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?
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: 



[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock
On 06/14/2010 05:13 PM, Valdis.Kletnieks at 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


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock
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 

---
 drivers/char/tpm/tpm.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

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);
 
-- 
1.7.1.rc1.21.gf3bd6

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/8]drivers:tmp.c Fix warning: variable 'rc' set but not used

2010-06-14 Thread Justin P. Mattock
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 

---
 drivers/char/tpm/tpm.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

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);

-- 
1.7.1.rc1.21.gf3bd6