All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [V2] stv090x: variable 'no_signal' set but not used
@ 2012-06-27 22:18 Peter Senna Tschudin
  2012-06-28  4:02 ` Ezequiel Garcia
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-06-27 22:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Guy Martin, Manu Abraham, Hans Verkuil,
	linux-media
  Cc: Peter Senna Tschudin

Remove variable and ignore return value of stv090x_chk_signal().

Tested by compilation only.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/media/dvb/frontends/stv090x.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index d79e69f..a4d5954 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3172,7 +3172,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
 	enum stv090x_signal_state signal_state = STV090x_NOCARRIER;
 	u32 reg;
 	s32 agc1_power, power_iq = 0, i;
-	int lock = 0, low_sr = 0, no_signal = 0;
+	int lock = 0, low_sr = 0;
 
 	reg = STV090x_READ_DEMOD(state, TSCFGH);
 	STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 1); /* Stop path 1 stream merger */
@@ -3413,7 +3413,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
 				goto err;
 		} else {
 			signal_state = STV090x_NODATA;
-			no_signal = stv090x_chk_signal(state);
+			(void) stv090x_chk_signal(state);
 		}
 	}
 	return signal_state;
-- 
1.7.10.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] [V2] stv090x: variable 'no_signal' set but not used
  2012-06-27 22:18 [PATCH] [V2] stv090x: variable 'no_signal' set but not used Peter Senna Tschudin
@ 2012-06-28  4:02 ` Ezequiel Garcia
  2012-06-28 13:17   ` Peter Senna Tschudin
  0 siblings, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2012-06-28  4:02 UTC (permalink / raw)
  To: Peter Senna Tschudin
  Cc: Mauro Carvalho Chehab, Guy Martin, Manu Abraham, Hans Verkuil,
	linux-media

Hey Peter,

On Wed, Jun 27, 2012 at 7:18 PM, Peter Senna Tschudin
<peter.senna@gmail.com> wrote:
> -                       no_signal = stv090x_chk_signal(state);
> +                       (void) stv090x_chk_signal(state);

Why are you casting return to void? I can't see there is a reason to it.

Regards,
Ezequiel.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [V2] stv090x: variable 'no_signal' set but not used
  2012-06-28  4:02 ` Ezequiel Garcia
@ 2012-06-28 13:17   ` Peter Senna Tschudin
  2012-06-28 13:25     ` Peter Senna Tschudin
  2012-06-28 13:41     ` Ezequiel Garcia
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-06-28 13:17 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Mauro Carvalho Chehab, Guy Martin, Manu Abraham, Hans Verkuil,
	linux-media

Hey Ezequiel,

On Thu, Jun 28, 2012 at 1:02 AM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
> Hey Peter,
>
> On Wed, Jun 27, 2012 at 7:18 PM, Peter Senna Tschudin
> <peter.senna@gmail.com> wrote:
>> -                       no_signal = stv090x_chk_signal(state);
>> +                       (void) stv090x_chk_signal(state);
>
> Why are you casting return to void? I can't see there is a reason to it.
The idea is to tell the compiler that I know that stv090x_chk_signal()
return a value and I want to ignore it. It is to prevent the compiler
to issue warn_unused_result. I found two ways of doing it. First is
casting the return to void, second is to change the function
definition adding the macro __must_check defined at <linux/compiler.c>
like on:

http://lxr.linux.no/linux+v3.4.4/include/linux/kernel.h#L215

The (void) solution looked simpler to me, but I'll be happy to change
to the __must_check solution if better. What do you think? Keep as is?
Add a comment? Change to __must_check?




>
> Regards,
> Ezequiel.

Regards,

Peter

-- 
Peter Senna Tschudin
peter.senna@gmail.com
gpg id: 48274C36

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [V2] stv090x: variable 'no_signal' set but not used
  2012-06-28 13:17   ` Peter Senna Tschudin
@ 2012-06-28 13:25     ` Peter Senna Tschudin
  2012-06-28 13:41     ` Ezequiel Garcia
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-06-28 13:25 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Mauro Carvalho Chehab, Guy Martin, Manu Abraham, Hans Verkuil,
	linux-media

On Thu, Jun 28, 2012 at 10:17 AM, Peter Senna Tschudin
<peter.senna@gmail.com> wrote:
> Hey Ezequiel,
>
> On Thu, Jun 28, 2012 at 1:02 AM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
>> Hey Peter,
>>
>> On Wed, Jun 27, 2012 at 7:18 PM, Peter Senna Tschudin
>> <peter.senna@gmail.com> wrote:
>>> -                       no_signal = stv090x_chk_signal(state);
>>> +                       (void) stv090x_chk_signal(state);
>>
>> Why are you casting return to void? I can't see there is a reason to it.
> The idea is to tell the compiler that I know that stv090x_chk_signal()
> return a value and I want to ignore it. It is to prevent the compiler
> to issue warn_unused_result. I found two ways of doing it. First is
> casting the return to void, second is to change the function
> definition adding the macro __must_check defined at <linux/compiler.c>
 defined at <linux/compiler.h>
> like on:
>
> http://lxr.linux.no/linux+v3.4.4/include/linux/kernel.h#L215
>
> The (void) solution looked simpler to me, but I'll be happy to change
> to the __must_check solution if better. What do you think? Keep as is?
> Add a comment? Change to __must_check?
>
>
>
>
>>
>> Regards,
>> Ezequiel.
>
> Regards,
>
> Peter
>
> --
> Peter Senna Tschudin
> peter.senna@gmail.com
> gpg id: 48274C36



-- 
Peter Senna Tschudin
peter.senna@gmail.com
gpg id: 48274C36

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [V2] stv090x: variable 'no_signal' set but not used
  2012-06-28 13:17   ` Peter Senna Tschudin
  2012-06-28 13:25     ` Peter Senna Tschudin
@ 2012-06-28 13:41     ` Ezequiel Garcia
  2012-06-28 13:55       ` Peter Senna Tschudin
  1 sibling, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2012-06-28 13:41 UTC (permalink / raw)
  To: Peter Senna Tschudin
  Cc: Mauro Carvalho Chehab, Guy Martin, Manu Abraham, Hans Verkuil,
	linux-media

On Thu, Jun 28, 2012 at 10:17 AM, Peter Senna Tschudin
<peter.senna@gmail.com> wrote:
> Hey Ezequiel,
>
> On Thu, Jun 28, 2012 at 1:02 AM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
>> Hey Peter,
>>
>> On Wed, Jun 27, 2012 at 7:18 PM, Peter Senna Tschudin
>> <peter.senna@gmail.com> wrote:
>>> -                       no_signal = stv090x_chk_signal(state);
>>> +                       (void) stv090x_chk_signal(state);
>>
>> Why are you casting return to void? I can't see there is a reason to it.
> The idea is to tell the compiler that I know that stv090x_chk_signal()
> return a value and I want to ignore it. It is to prevent the compiler
> to issue warn_unused_result. I found two ways of doing it. First is
> casting the return to void, second is to change the function
> definition adding the macro __must_check defined at <linux/compiler.c>
> like on:

This would be true if stv090x_chk_signal() would be declared with __must_check.
But this is not the case, so I think you should try to just ignore the result.

I'm pretty sure you won't find any warning at all from the compiler.

Regards,
Ezequiel.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [V2] stv090x: variable 'no_signal' set but not used
  2012-06-28 13:41     ` Ezequiel Garcia
@ 2012-06-28 13:55       ` Peter Senna Tschudin
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-06-28 13:55 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Mauro Carvalho Chehab, Guy Martin, Manu Abraham, Hans Verkuil,
	linux-media

On Thu, Jun 28, 2012 at 10:41 AM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
> On Thu, Jun 28, 2012 at 10:17 AM, Peter Senna Tschudin
> <peter.senna@gmail.com> wrote:
>> Hey Ezequiel,
>>
>> On Thu, Jun 28, 2012 at 1:02 AM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
>>> Hey Peter,
>>>
>>> On Wed, Jun 27, 2012 at 7:18 PM, Peter Senna Tschudin
>>> <peter.senna@gmail.com> wrote:
>>>> -                       no_signal = stv090x_chk_signal(state);
>>>> +                       (void) stv090x_chk_signal(state);
>>>
>>> Why are you casting return to void? I can't see there is a reason to it.
>> The idea is to tell the compiler that I know that stv090x_chk_signal()
>> return a value and I want to ignore it. It is to prevent the compiler
>> to issue warn_unused_result. I found two ways of doing it. First is
>> casting the return to void, second is to change the function
>> definition adding the macro __must_check defined at <linux/compiler.c>
>> like on:
>
> This would be true if stv090x_chk_signal() would be declared with __must_check.
> But this is not the case, so I think you should try to just ignore the result.
>
> I'm pretty sure you won't find any warning at all from the compiler.
You are right! Thanks. I'll do V3 of the patch.


>
> Regards,
> Ezequiel.



-- 
Peter Senna Tschudin
peter.senna@gmail.com
gpg id: 48274C36

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-06-28 13:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-27 22:18 [PATCH] [V2] stv090x: variable 'no_signal' set but not used Peter Senna Tschudin
2012-06-28  4:02 ` Ezequiel Garcia
2012-06-28 13:17   ` Peter Senna Tschudin
2012-06-28 13:25     ` Peter Senna Tschudin
2012-06-28 13:41     ` Ezequiel Garcia
2012-06-28 13:55       ` Peter Senna Tschudin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.