UPSTREAM: driver core: Prevent warning when removing a device link from unregistered consumer
sysfs_remove_link() causes a warning if the parent directory does not
exist. That can happen if the device link consumer has not been registered.
So do not attempt sysfs_remove_link() in that case.
Fixes: 287905e68dd29 ("driver core: Expose device link details in sysfs")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org # 5.9+
Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20210716114408.17320-2-adrian.hunter@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e64daad660a0c9ace3acdc57099fffe5ed83f977)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Idfa829a1a16960fd4ffd1c2733ae9f11f9123d09
This commit is contained in:
committed by
Connor O'Brien
parent
2e30052a73
commit
d7aa701af5
@@ -425,8 +425,10 @@ static void devlink_remove_symlinks(struct device *dev,
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(buf, len, "supplier:%s", dev_name(sup));
|
||||
sysfs_remove_link(&con->kobj, buf);
|
||||
if (device_is_registered(con)) {
|
||||
snprintf(buf, len, "supplier:%s", dev_name(sup));
|
||||
sysfs_remove_link(&con->kobj, buf);
|
||||
}
|
||||
snprintf(buf, len, "consumer:%s", dev_name(con));
|
||||
sysfs_remove_link(&sup->kobj, buf);
|
||||
kfree(buf);
|
||||
|
||||
Reference in New Issue
Block a user