Commit 1d597682 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'driver-core-5.14-rc3' of...

Merge tag 'driver-core-5.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are two small driver core fixes to resolve some reported problems
  for 5.14-rc3. They include:

   - aux bus memory leak fix

   - unneeded warning message removed when removing a device link.

  Both have been in linux-next with no reported problems"

* tag 'driver-core-5.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  driver core: Prevent warning when removing a device link from unregistered consumer
  driver core: auxiliary bus: Fix memory leak when driver_register() fail
parents 8072911b e64daad6
...@@ -231,6 +231,8 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device); ...@@ -231,6 +231,8 @@ EXPORT_SYMBOL_GPL(auxiliary_find_device);
int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, int __auxiliary_driver_register(struct auxiliary_driver *auxdrv,
struct module *owner, const char *modname) struct module *owner, const char *modname)
{ {
int ret;
if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table))
return -EINVAL; return -EINVAL;
...@@ -246,7 +248,11 @@ int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, ...@@ -246,7 +248,11 @@ int __auxiliary_driver_register(struct auxiliary_driver *auxdrv,
auxdrv->driver.bus = &auxiliary_bus_type; auxdrv->driver.bus = &auxiliary_bus_type;
auxdrv->driver.mod_name = modname; 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); EXPORT_SYMBOL_GPL(__auxiliary_driver_register);
......
...@@ -574,8 +574,10 @@ static void devlink_remove_symlinks(struct device *dev, ...@@ -574,8 +574,10 @@ static void devlink_remove_symlinks(struct device *dev,
return; return;
} }
snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup)); if (device_is_registered(con)) {
sysfs_remove_link(&con->kobj, buf); 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)); snprintf(buf, len, "consumer:%s:%s", dev_bus_name(con), dev_name(con));
sysfs_remove_link(&sup->kobj, buf); sysfs_remove_link(&sup->kobj, buf);
kfree(buf); kfree(buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment