Commit 0dea0141a9d9c33a669c546f8f5d9f44a0557375

Authored by David Herrmann
Committed by Gustavo Padovan
1 parent 053262dce5

Bluetooth: vhci: Ignore return code of nonseekable_open()

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>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

drivers/bluetooth/hci_vhci.c
... ... @@ -252,8 +252,9 @@
252 252 }
253 253  
254 254 file->private_data = data;
  255 + nonseekable_open(inode, file);
255 256  
256   - return nonseekable_open(inode, file);
  257 + return 0;
257 258 }
258 259  
259 260 static int vhci_release(struct inode *inode, struct file *file)