summaryrefslogtreecommitdiff
path: root/fs/sysfs/file.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2019-02-08 09:40:29 +0530
committerViresh Kumar <viresh.kumar@linaro.org>2019-02-08 09:40:29 +0530
commitaf816ddfbdf049dfce251513af4b5dc903c9764c (patch)
tree15fe94fb3dbb0db54d203c2a1229a0b7a9c3a608 /fs/sysfs/file.c
parent446fae2bb5395f3028d8e3aae1508737e5a72ea1 (diff)
parentdab535052f67db0ff48b1b23e714b58650d1a787 (diff)
Merge branch 'cpufreq/qcom-hw' into cpufreq/arm/linux-next
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r--fs/sysfs/file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index bb71db63c99c..51398457fe00 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -325,7 +325,8 @@ int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr,
kuid_t uid;
kgid_t gid;
- BUG_ON(!kobj || !kobj->sd || !attr);
+ if (WARN_ON(!kobj || !kobj->sd || !attr))
+ return -EINVAL;
kobject_get_ownership(kobj, &uid, &gid);
return sysfs_add_file_mode_ns(kobj->sd, attr, false, attr->mode,
@@ -537,7 +538,8 @@ int sysfs_create_bin_file(struct kobject *kobj,
kuid_t uid;
kgid_t gid;
- BUG_ON(!kobj || !kobj->sd || !attr);
+ if (WARN_ON(!kobj || !kobj->sd || !attr))
+ return -EINVAL;
kobject_get_ownership(kobj, &uid, &gid);
return sysfs_add_file_mode_ns(kobj->sd, &attr->attr, true,