Skip to content

Commit

Permalink
core: platform: add warning if driver has no owner
Browse files Browse the repository at this point in the history
Commit 9447057 ("platform_device: use a macro instead of
platform_driver_register") introduced a codepath which could result into
drivers having no owner. This went unnoticed for months, so add a
warning in case this happens again somewhere else somewhen.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Wolfram Sang authored and Greg Kroah-Hartman committed Nov 6, 2014
1 parent a8a93c6 commit 161d698
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/base/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ int driver_register(struct device_driver *drv)

BUG_ON(!drv->bus->p);

if (!drv->owner)
printk(KERN_WARNING "Driver '%s' needs an owner", drv->name);

if ((drv->bus->probe && drv->probe) ||
(drv->bus->remove && drv->remove) ||
(drv->bus->shutdown && drv->shutdown))
Expand Down

0 comments on commit 161d698

Please sign in to comment.