lkml.org 
[lkml]   [2013]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] driver-core: remove the duplicate assignment of kobj->parent in device_add
Date
kobject_add() will setup the kobject parent correctly.

This patch removes the redundant code.

Tested on Lenovo T420.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Reviewed-by: Ram Pai <linuxram@us.ibm.com>
Reviewed-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
drivers/base/core.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 5e6e00b..37d0ea8 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -992,8 +992,6 @@ int device_add(struct device *dev)

parent = get_device(dev->parent);
kobj = get_device_parent(dev, parent);
- if (kobj)
- dev->kobj.parent = kobj;

/* use parent numa_node */
if (parent)
@@ -1001,7 +999,7 @@ int device_add(struct device *dev)

/* first, register with generic layer. */
/* we require the name to be set before, and pass NULL */
- error = kobject_add(&dev->kobj, dev->kobj.parent, NULL);
+ error = kobject_add(&dev->kobj, kobj, NULL);
if (error)
goto Error;

--
1.7.5.4


\
 
 \ /
  Last update: 2013-01-23 07:41    [W:0.033 / U:1.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site