Use WARN() in drivers/base/

Use WARN() instead of a printk+WARN_ON() pair; this way the message
becomes part of the warning section for better reporting/collection.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Greg KH <greg@kroah.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Arjan van de Ven 2008-07-25 19:45:39 -07:00 committed by Linus Torvalds
parent 12e0036818
commit f810a5cf28
3 changed files with 7 additions and 14 deletions

View File

@ -116,12 +116,10 @@ static void device_release(struct kobject *kobj)
dev->type->release(dev); dev->type->release(dev);
else if (dev->class && dev->class->dev_release) else if (dev->class && dev->class->dev_release)
dev->class->dev_release(dev); dev->class->dev_release(dev);
else { else
printk(KERN_ERR "Device '%s' does not have a release() " WARN(1, KERN_ERR "Device '%s' does not have a release() "
"function, it is broken and must be fixed.\n", "function, it is broken and must be fixed.\n",
dev->bus_id); dev->bus_id);
WARN_ON(1);
}
} }
static struct kobj_type device_ktype = { static struct kobj_type device_ktype = {

View File

@ -204,9 +204,8 @@ memory_block_action(struct memory_block *mem, unsigned long action)
} }
break; break;
default: default:
printk(KERN_WARNING "%s(%p, %ld) unknown action: %ld\n", WARN(1, KERN_WARNING "%s(%p, %ld) unknown action: %ld\n",
__func__, mem, action, action); __func__, mem, action, action);
WARN_ON(1);
ret = -EINVAL; ret = -EINVAL;
} }

View File

@ -168,19 +168,16 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
int err = 0; int err = 0;
if (!cls) { if (!cls) {
printk(KERN_WARNING "sysdev: invalid class passed to " WARN(1, KERN_WARNING "sysdev: invalid class passed to "
"sysdev_driver_register!\n"); "sysdev_driver_register!\n");
WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
/* Check whether this driver has already been added to a class. */ /* Check whether this driver has already been added to a class. */
if (drv->entry.next && !list_empty(&drv->entry)) { if (drv->entry.next && !list_empty(&drv->entry))
printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" WARN(1, KERN_WARNING "sysdev: class %s: driver (%p) has already"
" been registered to a class, something is wrong, but " " been registered to a class, something is wrong, but "
"will forge on!\n", cls->name, drv); "will forge on!\n", cls->name, drv);
WARN_ON(1);
}
mutex_lock(&sysdev_drivers_lock); mutex_lock(&sysdev_drivers_lock);
if (cls && kset_get(&cls->kset)) { if (cls && kset_get(&cls->kset)) {
@ -194,8 +191,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
} }
} else { } else {
err = -EINVAL; err = -EINVAL;
printk(KERN_ERR "%s: invalid device class\n", __func__); WARN(1, KERN_ERR "%s: invalid device class\n", __func__);
WARN_ON(1);
} }
mutex_unlock(&sysdev_drivers_lock); mutex_unlock(&sysdev_drivers_lock);
return err; return err;