Skip to contentSkip to conversation

stv090x: variable 'no_signal' set but not used

PATCH Superseded Peter Senna Tschudin 2 participants 6 messages Jun 27, 2012 – Jun 28, 2012 Media (V4L/DVB)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 stv090x: variable 'no_signal' set but not used

Remove variable and ignore return value of stv090x_chk_signal().

Tested by compilation only.

---
 drivers/media/dvb/frontends/stv090x.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb/frontends/stv090x.c +2 -2
index d79e69f..a4d5954 100644
@@ -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;
Signature · 1 line
1.7.10.2
#1 lore raw

Hey Peter,

Quoted 2 lines · Peter Senna Tschudin

-                       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.

#2 lore raw

Hey Ezequiel,

Quoted 8 lines · Ezequiel Garcia

Hey Peter,

Quoted 2 lines · Peter Senna Tschudin

-                       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?

Quoted 3 lines

Regards,
Ezequiel.

Regards,

Peter

Signature · 3 lines
Peter Senna Tschudin
[email protected]
gpg id: 48274C36
#3 lore raw
Quoted 10 lines · Peter Senna Tschudin

Hey Ezequiel,

Quoted 7 lines · Ezequiel Garcia

Hey Peter,

Quoted 2 lines · Peter Senna Tschudin

-                       no_signal = stv090x_chk_signal(state);
+                       (void) stv090x_chk_signal(state);

Quoted 6 lines
Quoted 1 line

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>

Quoted 23 lines

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?

Quoted 3 lines

Regards,
Ezequiel.

Regards,

Peter

--
Peter Senna Tschudin
[email protected]
gpg id: 48274C36

Signature · 3 lines
Peter Senna Tschudin
[email protected]
gpg id: 48274C36
#4 lore raw
In reply to Peter Senna Tschudin
Quoted 10 lines · Peter Senna Tschudin

Hey Ezequiel,

Quoted 7 lines · Ezequiel Garcia

Hey Peter,

Quoted 2 lines · Peter Senna Tschudin

-                       no_signal = stv090x_chk_signal(state);
+                       (void) stv090x_chk_signal(state);

Quoted 7 lines
Quoted 1 line

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.

#5 lore raw
Quoted 20 lines · Ezequiel Garcia
Quoted 10 lines · Peter Senna Tschudin

Hey Ezequiel,

Quoted 7 lines · Ezequiel Garcia

Hey Peter,

Quoted 2 lines · Peter Senna Tschudin

-                       no_signal = stv090x_chk_signal(state);
+                       (void) stv090x_chk_signal(state);

Quoted 7 lines
Quoted 1 line

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:

Quoted 4 lines

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.

Quoted 3 lines

Regards,
Ezequiel.

Signature · 3 lines
Peter Senna Tschudin
[email protected]
gpg id: 48274C36