diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-05-14 17:14:54 -0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-05-30 01:39:33 -0400 |
commit | 704509b8d44886cebfbaff1a9813c35dfa986954 (patch) | |
tree | 7b353f1d4a33b31d55d2a85f8d70882ade1868ce /net/batman-adv/originator.c | |
parent | 958ca5985604a6f13387d32de489365df816558b (diff) |
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/originator.c')
-rw-r--r-- | net/batman-adv/originator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 3ea997deb112..a6c35d4e332b 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -86,7 +86,7 @@ struct neigh_node *create_neighbor(struct orig_node *orig_node, | |||
86 | bat_dbg(DBG_BATMAN, bat_priv, | 86 | bat_dbg(DBG_BATMAN, bat_priv, |
87 | "Creating new last-hop neighbor of originator\n"); | 87 | "Creating new last-hop neighbor of originator\n"); |
88 | 88 | ||
89 | neigh_node = kzalloc(sizeof(struct neigh_node), GFP_ATOMIC); | 89 | neigh_node = kzalloc(sizeof(*neigh_node), GFP_ATOMIC); |
90 | if (!neigh_node) | 90 | if (!neigh_node) |
91 | return NULL; | 91 | return NULL; |
92 | 92 | ||
@@ -196,7 +196,7 @@ struct orig_node *get_orig_node(struct bat_priv *bat_priv, const uint8_t *addr) | |||
196 | bat_dbg(DBG_BATMAN, bat_priv, | 196 | bat_dbg(DBG_BATMAN, bat_priv, |
197 | "Creating new originator: %pM\n", addr); | 197 | "Creating new originator: %pM\n", addr); |
198 | 198 | ||
199 | orig_node = kzalloc(sizeof(struct orig_node), GFP_ATOMIC); | 199 | orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC); |
200 | if (!orig_node) | 200 | if (!orig_node) |
201 | return NULL; | 201 | return NULL; |
202 | 202 | ||