Skip to contentSkip to conversation

can: softing: softing_startstop(): fix set but not used variable warning

PATCH In review Marc Kleine-Budde 3 participants 5 messages Jan 9, 2022 – Jan 10, 2022 CAN network drivers

lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#0 lore raw

PATCH 1/1 can: softing: softing_startstop(): fix set but not used variable warning

In the function softing_startstop() the variable error_reporting is assigned but not used. The code that uses this variable is commented out. Its stated that the functionality is not finally verified.

To fix the warning:

| drivers/net/can/softing/softing_fw.c:424:9: error: variable 'error_reporting' set but not used [-Werror,-Wunused-but-set-variable]
| int j, error_reporting;

remove the comment, activate the code, but add a "0 &&" to the if expression and rely on the optimizer rather than the preprocessor to remove the code.

Fixes 03fd3cf5a179 ("can: add driver for Softing card")
Cc Kurt Van Dijck <[email protected]>
---
 drivers/net/can/softing/softing_fw.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/can/softing/softing_fw.c +6 -5
index 7e1536877993..32286f861a19 100644
@@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up)
 		if (ret < 0)
 			goto failed;
 	}
-	/* enable_error_frame */
-	/*
+
+	/* enable_error_frame
+	 *
 	 * Error reporting is switched off at the moment since
 	 * the receiving of them is not yet 100% verified
 	 * This should be enabled sooner or later
-	 *
-	if (error_reporting) {
+	 */
+	if (0 && error_reporting) {
 		ret = softing_fct_cmd(card, 51, "enable_error_frame");
 		if (ret < 0)
 			goto failed;
 	}
-	*/
+
 	/* initialize interface */
 	iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]);
 	iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]);
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 1 line

out. Its stated that the functionality is not finally verified.

The subsequent call works, but I wasn't able to produce the bus errors, so I could not verify that is actually worked.

And by now, I don't have access to the card, nor do I have a PCMCIA slot :-)

Kurt

Quoted 53 lines · Marc Kleine-Budde

In the function softing_startstop() the variable error_reporting is assigned but not used. The code that uses this variable is commented out. Its stated that the functionality is not finally verified.

To fix the warning:

| drivers/net/can/softing/softing_fw.c:424:9: error: variable 'error_reporting' set but not used [-Werror,-Wunused-but-set-variable]
| int j, error_reporting;

remove the comment, activate the code, but add a "0 &&" to the if expression and rely on the optimizer rather than the preprocessor to remove the code.

Fixes 03fd3cf5a179 ("can: add driver for Softing card")
Cc Kurt Van Dijck <[email protected]>
---
 drivers/net/can/softing/softing_fw.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/can/softing/softing_fw.c +6 -5
index 7e1536877993..32286f861a19 100644
@@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up)
 		if (ret < 0)
 			goto failed;
 	}
-	/* enable_error_frame */
-	/*
+
+	/* enable_error_frame
+	 *
 	 * Error reporting is switched off at the moment since
 	 * the receiving of them is not yet 100% verified
 	 * This should be enabled sooner or later
-	 *
-	if (error_reporting) {
+	 */
+	if (0 && error_reporting) {
 		ret = softing_fct_cmd(card, 51, "enable_error_frame");
 		if (ret < 0)
 			goto failed;
 	}
-	*/
+
 	/* initialize interface */
 	iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]);
 	iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]);
Signature · 1 line
2.34.1
author maintainer
#2 lore raw
Quoted 8 lines · Kurt Van Dijck
Quoted 1 line

out. Its stated that the functionality is not finally verified.

The subsequent call works, but I wasn't able to produce the bus errors, so I could not verify that is actually worked.

And by now, I don't have access to the card, nor do I have a PCMCIA slot :-)

I think Oliver still has a laptop with a PCMCIA slot, but I don't know if he has that HW....

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#3 lore raw
Quoted 5 lines · Marc Kleine-Budde
Quoted 4 lines · Kurt Van Dijck
Quoted 1 line

out. Its stated that the functionality is not finally verified.

Quoted 7 lines
Quoted 4 lines

The subsequent call works, but I wasn't able to produce the bus errors, so I could not verify that is actually worked.

And by now, I don't have access to the card, nor do I have a PCMCIA slot :-)

I think Oliver still has a laptop with a PCMCIA slot, but I don't know if he has that HW....

Huh. I can search for that card in the office when I get there next time. I have no idea if someone binned the card in the meantime - as the Laptops do not provide PCMCIA for years now ...

I'll take a look.

Best,
Oliver

#4 lore raw
Quoted 9 lines · Oliver Hartkopp
Quoted 8 lines · Marc Kleine-Budde
Quoted 7 lines · Kurt Van Dijck
Quoted 1 line

out. Its stated that the functionality is not finally verified.

The subsequent call works, but I wasn't able to produce the bus errors, so I could not verify that is actually worked.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

And by now, I don't have access to the card, nor do I have a PCMCIA slot :-)

I think Oliver still has a laptop with a PCMCIA slot, but I don't know if he has that HW....

Huh. I can search for that card in the office when I get there next time. I have no idea if someone binned the card in the meantime - as the Laptops do not provide PCMCIA for years now ...

No-one ever asked for this feature, so would not spend too much time now.

Kurt