batman-adv: Check return value of try_module_get

New operations should not be started when they need an increased module
reference counter and try_module_get failed.

This patch addresses Coverity #712284: Unchecked return value

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
This commit is contained in:
Sven Eckelmann
2012-08-20 23:37:26 +02:00
committed by Antonio Quartulli
parent 8e7c15d6b5
commit bd5b80d51a
4 changed files with 12 additions and 18 deletions
+4 -2
View File
@@ -99,15 +99,17 @@ int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
static int batadv_log_open(struct inode *inode, struct file *file)
{
if (!try_module_get(THIS_MODULE))
return -EBUSY;
nonseekable_open(inode, file);
file->private_data = inode->i_private;
batadv_inc_module_count();
return 0;
}
static int batadv_log_release(struct inode *inode, struct file *file)
{
batadv_dec_module_count();
module_put(THIS_MODULE);
return 0;
}