Skip to contentSkip to conversation

net: dsa: motorcomm: fix unused-function warning

PATCH Applied Arnd Bergmann 2 participants 2 messages Sep 16 – Sep 21

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: motorcomm: fix unused-function warning

From: Arnd Bergmann <[email protected]>

gcc warns about an unused function here because the __maybe_unused attribute is in the wrong part of the prototype:

drivers/net/dsa/motorcomm/leds.c:352:1: error: 'yt921x_cled_hw_control_get_device' defined but not used [-Werror=unused-function]
352 | yt921x_cled_hw_control_get_device(struct led_classdev *led_cdev)

      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Move the __maybe_unused attribute to refer to the function rather than the returned object.

Fixes 9af9a8168213 ("net: dsa: motorcomm: Add LED support")
---
 drivers/net/dsa/motorcomm/leds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/motorcomm/leds.c +1 -1
index 87a6b9cf6068..0e8761f37995 100644
@@ -348,7 +348,7 @@ yt921x_cled_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on,
 	return res;
 }
 
-static struct device * __maybe_unused
+static struct device __maybe_unused *
 yt921x_cled_hw_control_get_device(struct led_classdev *led_cdev)
 {
 	struct yt921x_led *led = to_yt921x_led(led_cdev);
Signature · 1 line
2.53.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Wed, 16 Sep 2026 10:26:54 +0200 you wrote:

From: Arnd Bergmann <[email protected]>

gcc warns about an unused function here because the __maybe_unused attribute is in the wrong part of the prototype:

drivers/net/dsa/motorcomm/leds.c:352:1: error: 'yt921x_cled_hw_control_get_device' defined but not used [-Werror=unused-function]
352 | yt921x_cled_hw_control_get_device(struct led_classdev *led_cdev)

      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

Here is the summary with links:
- net: dsa: motorcomm: fix unused-function warning

    https://git.kernel.org/netdev/net-next/c/cc2d273893db

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html