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)
if (disk->private_data == NULL)
goto out;
sdkp = scsi_disk(disk);
if (!kref_get(&sdkp->kref))
goto out_sdkp;
kref_get(&sdkp->kref);
if (scsi_device_get(sdkp->device))
goto out_put;
up(&sd_ref_sem);
......@@ -189,7 +188,6 @@ static struct scsi_disk *scsi_disk_get(struct gendisk *disk)
out_put:
kref_put(&sdkp->kref, scsi_disk_release);
out_sdkp:
sdkp = NULL;
out:
up(&sd_ref_sem);
......
......@@ -140,15 +140,13 @@ static inline struct scsi_cd *scsi_cd_get(struct gendisk *disk)
if (disk->private_data == NULL)
goto out;
cd = scsi_cd(disk);
if (!kref_get(&cd->kref))
goto out_null;
kref_get(&cd->kref);
if (scsi_device_get(cd->device))
goto out_put;
goto out;
out_put:
kref_put(&cd->kref, sr_kref_release);
out_null:
cd = NULL;
out:
up(&sr_ref_sem);
......
......@@ -23,7 +23,7 @@ struct 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));
#endif /* _KREF_H_ */
......@@ -27,11 +27,10 @@ void kref_init(struct kref *kref)
* kref_get - increment refcount for object.
* @kref: object.
*/
struct kref *kref_get(struct kref *kref)
void kref_get(struct kref *kref)
{
WARN_ON(!atomic_read(&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