drivers/net/wan/hdlc_ppp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wan/hdlc_ppp.c: In function ‘ppp_cp_event’:
drivers/net/wan/hdlc_ppp.c:353:17: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
353 | netdev_info(dev, "%s down\n", proto_name(pid));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wan/hdlc_ppp.c:342:17: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
342 | netdev_info(dev, "%s up\n", proto_name(pid));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update proto_name() to return "LCP" by default instead of NULL.
This change silences the compiler without changing existing behavior
and removes the need for the local 'pname' variable in ppp_cp_event.
Suggested-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com>
---
v3:
- Retarget patch to net-next (cleanup, not bugfix)
- Remove 'Fixes' tag
- Drop explicit PID_LCP case in proto_name() per Chris’s suggestion
v2: https://lore.kernel.org/all/20251003092918.1428164-1-kriish.sharma2006@gmail.com/
- Target the net tree with proper subject prefix "[PATCH net]"
- Update proto_name() to return "LCP" by default instead of NULL
- Remove local 'pname' variable in ppp_cp_event
- Add Suggested-by tag for Krzysztof Hałasa
v1: https://lore.kernel.org/all/20251002180541.1375151-1-kriish.sharma2006@gmail.com/
drivers/net/wan/hdlc_ppp.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 7496a2e9a282..159295c4bd6d 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -126,14 +126,12 @@ static inline struct proto *get_proto(struct net_device *dev, u16 pid)
static inline const char *proto_name(u16 pid)
{
switch (pid) {
- case PID_LCP:
- return "LCP";
case PID_IPCP:
return "IPCP";
case PID_IPV6CP:
return "IPV6CP";
default:
- return NULL;
+ return "LCP";
}
}
--
2.34.1
Kriish Sharma <kriish.sharma2006@gmail.com> writes:
> Update proto_name() to return "LCP" by default instead of NULL.
> This change silences the compiler without changing existing behavior
> and removes the need for the local 'pname' variable in ppp_cp_event.
>
> Suggested-by: Krzysztof Hałasa <khalasa@piap.pl>
> Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com>
Thanks, and
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
> --- a/drivers/net/wan/hdlc_ppp.c
> +++ b/drivers/net/wan/hdlc_ppp.c
> @@ -126,14 +126,12 @@ static inline struct proto *get_proto(struct net_device *dev, u16 pid)
> static inline const char *proto_name(u16 pid)
> {
> switch (pid) {
> - case PID_LCP:
> - return "LCP";
> case PID_IPCP:
> return "IPCP";
> case PID_IPV6CP:
> return "IPV6CP";
> default:
> - return NULL;
> + return "LCP";
> }
> }
>
--
Krzysztof "Chris" Hałasa
Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa
© 2016 - 2025 Red Hat, Inc.