Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c3e8964 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

sysfs: spit a warning to users when they try to create a duplicate sysfs file



We want to let people know when we create a duplicate sysfs file, as
they need to fix up their code.


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dc8c8587
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -428,8 +428,12 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt,
 */
int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
{
	if (sysfs_find_dirent(acxt->parent_sd, sd->s_name))
	if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) {
		printk(KERN_WARNING "sysfs: duplicate filename '%s' "
		       "can not be created\n", sd->s_name);
		WARN_ON(1);
		return -EEXIST;
	}

	sd->s_parent = sysfs_get(acxt->parent_sd);