aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2011-05-14 17:14:54 -0400
committerSven Eckelmann <sven@narfation.org>2011-05-30 01:39:33 -0400
commit704509b8d44886cebfbaff1a9813c35dfa986954 (patch)
tree7b353f1d4a33b31d55d2a85f8d70882ade1868ce /net/batman-adv/translation-table.c
parent958ca5985604a6f13387d32de489365df816558b (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/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 802eacef05b8..561f76968d5e 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -164,7 +164,7 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr)
164 bat_dbg(DBG_ROUTES, bat_priv, 164 bat_dbg(DBG_ROUTES, bat_priv,
165 "Creating new local tt entry: %pM\n", addr); 165 "Creating new local tt entry: %pM\n", addr);
166 166
167 tt_local_entry = kmalloc(sizeof(struct tt_local_entry), GFP_ATOMIC); 167 tt_local_entry = kmalloc(sizeof(*tt_local_entry), GFP_ATOMIC);
168 if (!tt_local_entry) 168 if (!tt_local_entry)
169 return; 169 return;
170 170
@@ -427,9 +427,8 @@ void tt_global_add_orig(struct bat_priv *bat_priv,
427 if (!tt_global_entry) { 427 if (!tt_global_entry) {
428 spin_unlock_bh(&bat_priv->tt_ghash_lock); 428 spin_unlock_bh(&bat_priv->tt_ghash_lock);
429 429
430 tt_global_entry = 430 tt_global_entry = kmalloc(sizeof(*tt_global_entry),
431 kmalloc(sizeof(struct tt_global_entry), 431 GFP_ATOMIC);
432 GFP_ATOMIC);
433 432
434 if (!tt_global_entry) 433 if (!tt_global_entry)
435 break; 434 break;