mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
swsusp: fix error paths in snapshot_open
We forget to increase device_available if there's an error in snapshot_open(), so the snapshot device cannot be open at all after snapshot_open() has returned an error. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
04293355ac
commit
1525a2ad76
1 changed files with 6 additions and 4 deletions
|
|
@ -49,12 +49,14 @@ static int snapshot_open(struct inode *inode, struct file *filp)
|
|||
if (!atomic_add_unless(&device_available, -1, 0))
|
||||
return -EBUSY;
|
||||
|
||||
if ((filp->f_flags & O_ACCMODE) == O_RDWR)
|
||||
if ((filp->f_flags & O_ACCMODE) == O_RDWR) {
|
||||
atomic_inc(&device_available);
|
||||
return -ENOSYS;
|
||||
|
||||
if(create_basic_memory_bitmaps())
|
||||
}
|
||||
if(create_basic_memory_bitmaps()) {
|
||||
atomic_inc(&device_available);
|
||||
return -ENOMEM;
|
||||
|
||||
}
|
||||
nonseekable_open(inode, filp);
|
||||
data = &snapshot_state;
|
||||
filp->private_data = data;
|
||||
|
|
|
|||
Loading…
Reference in a new issue