提交 7a23ad44 编写于 作者: T Tejun Heo 提交者: Greg Kroah-Hartman

sysfs: make sysfs_put() ignore NULL sd

Make sysfs_put() ignore NULL sd instead of oopsing.
Signed-off-by: NTejun Heo <htejun@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 2b611bb7
...@@ -111,7 +111,7 @@ static inline struct sysfs_dirent * sysfs_get(struct sysfs_dirent * sd) ...@@ -111,7 +111,7 @@ static inline struct sysfs_dirent * sysfs_get(struct sysfs_dirent * sd)
static inline void sysfs_put(struct sysfs_dirent * sd) static inline void sysfs_put(struct sysfs_dirent * sd)
{ {
if (atomic_dec_and_test(&sd->s_count)) if (sd && atomic_dec_and_test(&sd->s_count))
release_sysfs_dirent(sd); release_sysfs_dirent(sd);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册