]> err.no Git - linux-2.6/commitdiff
Use WARN() in fs/sysfs
authorArjan van de Ven <arjan@linux.intel.com>
Sat, 26 Jul 2008 02:45:41 +0000 (19:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 26 Jul 2008 19:00:07 +0000 (12:00 -0700)
Use WARN() instead of a printk+WARN_ON() pair; this way the message becomes
part of the warning section for better reporting/collection.  Also, with this,
one fo the if() sections collapses entirely into the WARN().

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/sysfs/dir.c
fs/sysfs/file.c
fs/sysfs/group.c

index c1a7efb310bf3517ab1bf52bb1312a79a517f2d6..aedaeba82ae5503a41cbd6ee366601ecb67ae31b 100644 (file)
@@ -459,11 +459,8 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
        int ret;
 
        ret = __sysfs_add_one(acxt, sd);
-       if (ret == -EEXIST) {
-               printk(KERN_WARNING "sysfs: duplicate filename '%s' "
+       WARN(ret == -EEXIST, KERN_WARNING "sysfs: duplicate filename '%s' "
                       "can not be created\n", sd->s_name);
-               WARN_ON(1);
-       }
        return ret;
 }
 
index 3f07893ff8968a483f4c5fc45646c80e3535966f..c9e4e5091da14c24b185b67419f3207188150f96 100644 (file)
@@ -337,9 +337,8 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
        if (kobj->ktype && kobj->ktype->sysfs_ops)
                ops = kobj->ktype->sysfs_ops;
        else {
-               printk(KERN_ERR "missing sysfs attribute operations for "
+               WARN(1, KERN_ERR "missing sysfs attribute operations for "
                       "kobject: %s\n", kobject_name(kobj));
-               WARN_ON(1);
                goto err_out;
        }
 
index eeba38417b1d4c5db2a54e381fb68b8441eb7743..fe611949a7f7419f789dbb8b4335b76d03e9fab9 100644 (file)
@@ -134,9 +134,8 @@ void sysfs_remove_group(struct kobject * kobj,
        if (grp->name) {
                sd = sysfs_get_dirent(dir_sd, grp->name);
                if (!sd) {
-                       printk(KERN_WARNING "sysfs group %p not found for "
+                       WARN(!sd, KERN_WARNING "sysfs group %p not found for "
                                "kobject '%s'\n", grp, kobject_name(kobj));
-                       WARN_ON(!sd);
                        return;
                }
        } else