Skip to content

Commit

Permalink
sysfs: kill unnecessary NULL pointer check in sysfs_release()
Browse files Browse the repository at this point in the history
In sysfs_release(), sysfs_buffer pointed to by filp->private_data is
guaranteed to exist.  Kill the unnecessary NULL check.  This also
makes the code more consistent with the counterpart in fs/sysfs/bin.c.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
htejun authored and gregkh committed Oct 12, 2007
1 parent b05f054 commit 50ab1a7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fs/sysfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,10 @@ static int sysfs_release(struct inode * inode, struct file * filp)
{
struct sysfs_buffer *buffer = filp->private_data;

if (buffer) {
if (buffer->page)
free_page((unsigned long)buffer->page);
kfree(buffer);
}
if (buffer->page)
free_page((unsigned long)buffer->page);
kfree(buffer);

return 0;
}

Expand Down

0 comments on commit 50ab1a7

Please sign in to comment.