Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320960
b: refs/heads/master
c: 20818a0
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Jul 29, 2012
1 parent 4e8b1e8 commit 775dd32
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09fada5b5f1f56502bb14f36a69a2c31cea262be
refs/heads/master: 20818a0caa84adbfe2f1e9c0e036f5b09a9692a2
12 changes: 5 additions & 7 deletions trunk/drivers/usb/gadget/storage_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,8 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
if (!(filp->f_mode & FMODE_WRITE))
ro = 1;

if (filp->f_path.dentry)
inode = filp->f_path.dentry->d_inode;
if (!inode || (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) {
inode = filp->f_path.dentry->d_inode;
if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) {
LINFO(curlun, "invalid file type: %s\n", filename);
goto out;
}
Expand All @@ -665,7 +664,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
* If we can't read the file, it's no good.
* If we can't write the file, use it read-only.
*/
if (!filp->f_op || !(filp->f_op->read || filp->f_op->aio_read)) {
if (!(filp->f_op->read || filp->f_op->aio_read)) {
LINFO(curlun, "file not readable: %s\n", filename);
goto out;
}
Expand Down Expand Up @@ -707,16 +706,15 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
goto out;
}

get_file(filp);
curlun->ro = ro;
curlun->filp = filp;
curlun->file_length = size;
curlun->num_sectors = num_sectors;
LDBG(curlun, "open backing file: %s\n", filename);
rc = 0;
return 0;

out:
filp_close(filp, current->files);
fput(filp);
return rc;
}

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/usb/gadget/u_uac1.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,17 @@ static int gaudio_close_snd_dev(struct gaudio *gau)
/* Close control device */
snd = &gau->control;
if (snd->filp)
filp_close(snd->filp, current->files);
filp_close(snd->filp, NULL);

/* Close PCM playback device and setup substream */
snd = &gau->playback;
if (snd->filp)
filp_close(snd->filp, current->files);
filp_close(snd->filp, NULL);

/* Close PCM capture device and setup substream */
snd = &gau->capture;
if (snd->filp)
filp_close(snd->filp, current->files);
filp_close(snd->filp, NULL);

return 0;
}
Expand Down

0 comments on commit 775dd32

Please sign in to comment.