diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-05-14 23:14:54 +0200 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-05-30 07:39:33 +0200 |
commit | 704509b8d44886cebfbaff1a9813c35dfa986954 (patch) | |
tree | 7b353f1d4a33b31d55d2a85f8d70882ade1868ce /net/batman-adv/hard-interface.c | |
parent | 958ca5985604a6f13387d32de489365df816558b (diff) | |
download | blackbird-op-linux-704509b8d44886cebfbaff1a9813c35dfa986954.tar.gz blackbird-op-linux-704509b8d44886cebfbaff1a9813c35dfa986954.zip |
batman-adv: Calculate sizeof using variable insead of types
Documentation/CodingStyle recommends to use the form
p = kmalloc(sizeof(*p), ...);
to calculate the size of a struct and not the version where the struct
name is spelled out to prevent bugs when the type of p changes. This
also seems appropriate for manipulation of buffers when they are
directly associated with p.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/hard-interface.c')
-rw-r--r-- | net/batman-adv/hard-interface.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index e626e75a7e65..e0052cf389db 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -459,7 +459,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev) dev_hold(net_dev); - hard_iface = kmalloc(sizeof(struct hard_iface), GFP_ATOMIC); + hard_iface = kmalloc(sizeof(*hard_iface), GFP_ATOMIC); if (!hard_iface) { pr_err("Can't add interface (%s): out of memory\n", net_dev->name); |