Merge tag 'driver-core-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core
Pull driver core fixes from Danilo Krummrich: - Remove the software node on platform device release(); without this, the software node remains registered after the device is gone and a subsequent platform_device_register_full() reusing the same node fails with -EBUSY - In sysfs_update_group(), do not remove a pre-existing directory when create_files() fails; the previous code would silently destroy a sysfs group that the caller did not create - Set fwnode->secondary to NULL in fwnode_init() to avoid dereferencing uninitialized memory (e.g. in dev_to_swnode()) when the firmware node is allocated on the stack or via a non-zeroing allocator * tag 'driver-core-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: device property: set fwnode->secondary to NULL in fwnode_init() sysfs: don't remove existing directory on update failure driver core: platform: remove software node on release()
This commit is contained in:
commit
c8561c73b4
3 files changed
+17
-2
No files matched your search
+15
-1
@@ -606,6 +606,12 @@ static void platform_device_release(struct device *dev)
|
||||
kfree(pa);
|
||||
}
|
||||
|
||||
static void platform_device_release_full(struct device *dev)
|
||||
{
|
||||
device_remove_software_node(dev);
|
||||
platform_device_release(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* platform_device_alloc - create a platform device
|
||||
* @name: base name of the device we're adding
|
||||
@@ -848,7 +854,13 @@ struct platform_device *platform_device_register_full(const struct platform_devi
|
||||
int ret;
|
||||
struct platform_device *pdev;
|
||||
|
||||
if (pdevinfo->swnode && pdevinfo->properties)
|
||||
/*
|
||||
* Only one software node per device is allowed. Make sure we don't
|
||||
* accept or create two.
|
||||
*/
|
||||
if ((pdevinfo->swnode && pdevinfo->properties) ||
|
||||
(pdevinfo->swnode && is_software_node(pdevinfo->fwnode)) ||
|
||||
(pdevinfo->properties && is_software_node(pdevinfo->fwnode)))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id);
|
||||
@@ -878,6 +890,8 @@ struct platform_device *platform_device_register_full(const struct platform_devi
|
||||
ret = device_add_software_node(&pdev->dev, pdevinfo->swnode);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
pdev->dev.release = platform_device_release_full;
|
||||
} else if (pdevinfo->properties) {
|
||||
ret = device_create_managed_software_node(&pdev->dev,
|
||||
pdevinfo->properties, NULL);
|
||||
|
||||
Reference in new issue
Block a user