diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2008-01-31 04:39:38 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-02 18:14:49 -0500 |
commit | 0c98b19fe571ede1f14bd95b855bcbe2cca99bcf (patch) | |
tree | 388875be014f29a9f68c89144925d68542c42a4a /drivers/base/core.c | |
parent | 44414e14af3f18fc8c1b94e259cd760366f665ee (diff) |
Driver core: Remove unneeded get_{device,driver}() calls.
Driver core: Remove unneeded get_{device,driver}() calls.
Code trying to add/remove attributes must hold a reference to
the device resp. driver anyway, so let's remove those reference
count games.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index a0cfda553c9d..9c0070b5bd3e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -423,10 +423,8 @@ struct kset *devices_kset; | |||
423 | int device_create_file(struct device *dev, struct device_attribute *attr) | 423 | int device_create_file(struct device *dev, struct device_attribute *attr) |
424 | { | 424 | { |
425 | int error = 0; | 425 | int error = 0; |
426 | if (get_device(dev)) { | 426 | if (dev) |
427 | error = sysfs_create_file(&dev->kobj, &attr->attr); | 427 | error = sysfs_create_file(&dev->kobj, &attr->attr); |
428 | put_device(dev); | ||
429 | } | ||
430 | return error; | 428 | return error; |
431 | } | 429 | } |
432 | 430 | ||
@@ -437,10 +435,8 @@ int device_create_file(struct device *dev, struct device_attribute *attr) | |||
437 | */ | 435 | */ |
438 | void device_remove_file(struct device *dev, struct device_attribute *attr) | 436 | void device_remove_file(struct device *dev, struct device_attribute *attr) |
439 | { | 437 | { |
440 | if (get_device(dev)) { | 438 | if (dev) |
441 | sysfs_remove_file(&dev->kobj, &attr->attr); | 439 | sysfs_remove_file(&dev->kobj, &attr->attr); |
442 | put_device(dev); | ||
443 | } | ||
444 | } | 440 | } |
445 | 441 | ||
446 | /** | 442 | /** |