Commit 01fb6e1b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

KREF: make kref_get() return void as it makes sense to do so.

Thanks to Kiran for bugging me to do this.
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 95b86e6b
...@@ -180,8 +180,7 @@ static struct scsi_disk *scsi_disk_get(struct gendisk *disk) ...@@ -180,8 +180,7 @@ static struct scsi_disk *scsi_disk_get(struct gendisk *disk)
if (disk->private_data == NULL) if (disk->private_data == NULL)
goto out; goto out;
sdkp = scsi_disk(disk); sdkp = scsi_disk(disk);
if (!kref_get(&sdkp->kref)) kref_get(&sdkp->kref);
goto out_sdkp;
if (scsi_device_get(sdkp->device)) if (scsi_device_get(sdkp->device))
goto out_put; goto out_put;
up(&sd_ref_sem); up(&sd_ref_sem);
...@@ -189,7 +188,6 @@ static struct scsi_disk *scsi_disk_get(struct gendisk *disk) ...@@ -189,7 +188,6 @@ static struct scsi_disk *scsi_disk_get(struct gendisk *disk)
out_put: out_put:
kref_put(&sdkp->kref, scsi_disk_release); kref_put(&sdkp->kref, scsi_disk_release);
out_sdkp:
sdkp = NULL; sdkp = NULL;
out: out:
up(&sd_ref_sem); up(&sd_ref_sem);
......
...@@ -140,15 +140,13 @@ static inline struct scsi_cd *scsi_cd_get(struct gendisk *disk) ...@@ -140,15 +140,13 @@ static inline struct scsi_cd *scsi_cd_get(struct gendisk *disk)
if (disk->private_data == NULL) if (disk->private_data == NULL)
goto out; goto out;
cd = scsi_cd(disk); cd = scsi_cd(disk);
if (!kref_get(&cd->kref)) kref_get(&cd->kref);
goto out_null;
if (scsi_device_get(cd->device)) if (scsi_device_get(cd->device))
goto out_put; goto out_put;
goto out; goto out;
out_put: out_put:
kref_put(&cd->kref, sr_kref_release); kref_put(&cd->kref, sr_kref_release);
out_null:
cd = NULL; cd = NULL;
out: out:
up(&sr_ref_sem); up(&sr_ref_sem);
......
...@@ -23,7 +23,7 @@ struct kref { ...@@ -23,7 +23,7 @@ struct kref {
}; };
void kref_init(struct kref *kref); void kref_init(struct kref *kref);
struct kref *kref_get(struct kref *kref); void kref_get(struct kref *kref);
void kref_put(struct kref *kref, void (*release) (struct kref *kref)); void kref_put(struct kref *kref, void (*release) (struct kref *kref));
#endif /* _KREF_H_ */ #endif /* _KREF_H_ */
...@@ -27,11 +27,10 @@ void kref_init(struct kref *kref) ...@@ -27,11 +27,10 @@ void kref_init(struct kref *kref)
* kref_get - increment refcount for object. * kref_get - increment refcount for object.
* @kref: object. * @kref: object.
*/ */
struct kref *kref_get(struct kref *kref) void kref_get(struct kref *kref)
{ {
WARN_ON(!atomic_read(&kref->refcount)); WARN_ON(!atomic_read(&kref->refcount));
atomic_inc(&kref->refcount); atomic_inc(&kref->refcount);
return kref;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment