Skip to content

Commit

Permalink
Bluetooth: vhci: Ignore return code of nonseekable_open()
Browse files Browse the repository at this point in the history
The comment in ./fs/open.c clearly states that nonseekable_open() will
never fail. Therefore, we can safely ignore the return code. This is the
recommended way to deal with nonseekable_open().
Our current code looks like nonseekable_open() is checked for the return
code. However, if we check the return code, we must also kfree() our
private data if the open fails. To avoid this overhead and to avoid
confusion, we simply drop the return code and return 0.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
David Herrmann authored and Gustavo Padovan committed May 9, 2012
1 parent 053262d commit 0dea014
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/bluetooth/hci_vhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ static int vhci_open(struct inode *inode, struct file *file)
}

file->private_data = data;
nonseekable_open(inode, file);

return nonseekable_open(inode, file);
return 0;
}

static int vhci_release(struct inode *inode, struct file *file)
Expand Down

0 comments on commit 0dea014

Please sign in to comment.