scsi host refcounting
Hi,
I'm hot on the trail of how adding a SCSI LLD in the kernel works, but i seem to have lost my bearings.
in the scsi_add_host_with_dma() procedure, it device_add()s shost_gendev which has the side effect of incrementing the kobj refcount of its parent. in my case, its a pci_dev.dev. a few lines after, it calls get_device(shost->shost_gendev.parent); which would _also_ increment the parent refcount. shouldn't it just do a single bump instead of two? see snip below:
-- snip --
error = device_add(&shost->shost_gendev);
if (error)
goto out;.......
scsi_host_set_state(shost, SHOST_RUNNING);
get_device(shost->shost_gendev.parent);-- snip --
I'm just ocularly following the codes right now so i might have missed a device_put on the parent somewhere. please enlighten me on this.
regards