Skip to content

Commit

Permalink
sound_firmware: don't bother with filp_close()
Browse files Browse the repository at this point in the history
it's opened read-only and never installed into any descriptor tables;
fput() will do just as well.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Apr 9, 2013
1 parent 264bd66 commit 434b5a2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sound/sound_firmware.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <linux/vmalloc.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <asm/uaccess.h>
Expand All @@ -23,25 +24,25 @@ static int do_mod_firmware_load(const char *fn, char **fp)
if (l <= 0 || l > 131072)
{
printk(KERN_INFO "Invalid firmware '%s'\n", fn);
filp_close(filp, NULL);
fput(filp);
return 0;
}
dp = vmalloc(l);
if (dp == NULL)
{
printk(KERN_INFO "Out of memory loading '%s'.\n", fn);
filp_close(filp, NULL);
fput(filp);
return 0;
}
pos = 0;
if (vfs_read(filp, dp, l, &pos) != l)
{
printk(KERN_INFO "Failed to read '%s'.\n", fn);
vfree(dp);
filp_close(filp, NULL);
fput(filp);
return 0;
}
filp_close(filp, NULL);
fput(filp);
*fp = dp;
return (int) l;
}
Expand Down

0 comments on commit 434b5a2

Please sign in to comment.