diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-27 09:22:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-27 09:22:08 +0200 |
commit | bdac4d8abbfc239886103f7c6ee03abb8011a008 (patch) | |
tree | fda39ff9008b28d574ccd647f41a243183663127 /drivers/base | |
parent | e7deeb9d79d8691f1e6c4c6707471ec3d7b9886b (diff) | |
parent | ff1176468d368232b684f75e82563369208bc371 (diff) | |
download | linux-stable-bdac4d8abbfc239886103f7c6ee03abb8011a008.tar.gz linux-stable-bdac4d8abbfc239886103f7c6ee03abb8011a008.tar.bz2 linux-stable-bdac4d8abbfc239886103f7c6ee03abb8011a008.zip |
Merge 5.14-rc3 into driver-core-next
We need the driver-core fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/auxiliary.c | 8 | ||||
-rw-r--r-- | drivers/base/core.c | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c index 0c86f5bed9f4..9230c9472bb0 100644 --- a/drivers/base/auxiliary.c +++ b/drivers/base/auxiliary.c @@ -229,6 +229,8 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device); int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner, const char *modname) { + int ret; + if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) return -EINVAL; @@ -244,7 +246,11 @@ int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, auxdrv->driver.bus = &auxiliary_bus_type; auxdrv->driver.mod_name = modname; - return driver_register(&auxdrv->driver); + ret = driver_register(&auxdrv->driver); + if (ret) + kfree(auxdrv->driver.name); + + return ret; } EXPORT_SYMBOL_GPL(__auxiliary_driver_register); diff --git a/drivers/base/core.c b/drivers/base/core.c index cadcade65825..f6360490a4a3 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -574,8 +574,10 @@ static void devlink_remove_symlinks(struct device *dev, return; } - snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup)); - sysfs_remove_link(&con->kobj, buf); + if (device_is_registered(con)) { + snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup)); + sysfs_remove_link(&con->kobj, buf); + } snprintf(buf, len, "consumer:%s:%s", dev_bus_name(con), dev_name(con)); sysfs_remove_link(&sup->kobj, buf); kfree(buf); |