* [PATCH] Bluetooth: 6lowpan: Make variable header_ops constant
@ 2019-08-15 5:52 Nishka Dasgupta
2019-08-15 6:46 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Nishka Dasgupta @ 2019-08-15 5:52 UTC (permalink / raw)
To: marcel, johan.hedberg, linux-bluetooth, linux-kernel, davem, netdev
Cc: Nishka Dasgupta
Static variable header_ops, of type header_ops, is used only once, when
it is assigned to field header_ops of a variable having type net_device.
This corresponding field is declared as const in the definition of
net_device. Hence make header_ops constant as well to protect it from
unnecessary modification.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
net/bluetooth/6lowpan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 9d41de1ec90f..bb55d92691b0 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -583,7 +583,7 @@ static const struct net_device_ops netdev_ops = {
.ndo_start_xmit = bt_xmit,
};
-static struct header_ops header_ops = {
+static const struct header_ops header_ops = {
.create = header_create,
};
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: 6lowpan: Make variable header_ops constant
2019-08-15 5:52 [PATCH] Bluetooth: 6lowpan: Make variable header_ops constant Nishka Dasgupta
@ 2019-08-15 6:46 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2019-08-15 6:46 UTC (permalink / raw)
To: Nishka Dasgupta
Cc: Johan Hedberg, linux-bluetooth, linux-kernel, David S. Miller, netdev
Hi Nishka,
> Static variable header_ops, of type header_ops, is used only once, when
> it is assigned to field header_ops of a variable having type net_device.
> This corresponding field is declared as const in the definition of
> net_device. Hence make header_ops constant as well to protect it from
> unnecessary modification.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
> net/bluetooth/6lowpan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-15 6:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 5:52 [PATCH] Bluetooth: 6lowpan: Make variable header_ops constant Nishka Dasgupta
2019-08-15 6:46 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).