Skip to contentSkip to conversation

sysfs: Use local reference in compat_only_sysfs_link_entry_to_kobj()

PATCH New Geert Uytterhoeven 1 participant 1 message Jul 14, 2021 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysfs: Use local reference in compat_only_sysfs_link_entry_to_kobj()

As we have just obtained target_kobj->sd into a local variable, and incremented the object's reference count, it is better to use the local variable instead of the original reference.

---
 fs/sysfs/group.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/sysfs/group.c +1 -1
index 64e6a6698935e925..f29d6200452725d4 100644
@@ -446,7 +446,7 @@ int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
 	if (!target)
 		return -ENOENT;
 
-	entry = kernfs_find_and_get(target_kobj->sd, target_name);
+	entry = kernfs_find_and_get(target, target_name);
 	if (!entry) {
 		kernfs_put(target);
 		return -ENOENT;
Signature · 1 line
2.25.1