diff options
author | Mike Anderson <andmike@us.ibm.com> | 2006-03-27 12:37:28 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-04-13 11:13:22 -0400 |
commit | 92aab6464be735139f9ea38fd039c3b84c722630 (patch) | |
tree | 70fa55f92e51449066ca50853bc7635b38543e5c /drivers/scsi/scsi_transport_sas.c | |
parent | 9a72f976d29091e4f4dfa08ed404ef84a56b0d47 (diff) |
[SCSI] sas transport: ref count update
Fix puts so that release functions will be called.
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_sas.c')
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 134c44c8538a..f6f7fecc0ad1 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -406,8 +406,6 @@ struct sas_phy *sas_phy_alloc(struct device *parent, int number) | |||
406 | if (!phy) | 406 | if (!phy) |
407 | return NULL; | 407 | return NULL; |
408 | 408 | ||
409 | get_device(parent); | ||
410 | |||
411 | phy->number = number; | 409 | phy->number = number; |
412 | 410 | ||
413 | device_initialize(&phy->dev); | 411 | device_initialize(&phy->dev); |
@@ -459,10 +457,7 @@ EXPORT_SYMBOL(sas_phy_add); | |||
459 | void sas_phy_free(struct sas_phy *phy) | 457 | void sas_phy_free(struct sas_phy *phy) |
460 | { | 458 | { |
461 | transport_destroy_device(&phy->dev); | 459 | transport_destroy_device(&phy->dev); |
462 | put_device(phy->dev.parent); | 460 | put_device(&phy->dev); |
463 | put_device(phy->dev.parent); | ||
464 | put_device(phy->dev.parent); | ||
465 | kfree(phy); | ||
466 | } | 461 | } |
467 | EXPORT_SYMBOL(sas_phy_free); | 462 | EXPORT_SYMBOL(sas_phy_free); |
468 | 463 | ||
@@ -484,7 +479,7 @@ sas_phy_delete(struct sas_phy *phy) | |||
484 | transport_remove_device(dev); | 479 | transport_remove_device(dev); |
485 | device_del(dev); | 480 | device_del(dev); |
486 | transport_destroy_device(dev); | 481 | transport_destroy_device(dev); |
487 | put_device(dev->parent); | 482 | put_device(dev); |
488 | } | 483 | } |
489 | EXPORT_SYMBOL(sas_phy_delete); | 484 | EXPORT_SYMBOL(sas_phy_delete); |
490 | 485 | ||
@@ -800,7 +795,6 @@ struct sas_rphy *sas_end_device_alloc(struct sas_phy *parent) | |||
800 | 795 | ||
801 | rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); | 796 | rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); |
802 | if (!rdev) { | 797 | if (!rdev) { |
803 | put_device(&parent->dev); | ||
804 | return NULL; | 798 | return NULL; |
805 | } | 799 | } |
806 | 800 | ||
@@ -836,7 +830,6 @@ struct sas_rphy *sas_expander_alloc(struct sas_phy *parent, | |||
836 | 830 | ||
837 | rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); | 831 | rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); |
838 | if (!rdev) { | 832 | if (!rdev) { |
839 | put_device(&parent->dev); | ||
840 | return NULL; | 833 | return NULL; |
841 | } | 834 | } |
842 | 835 | ||
@@ -910,6 +903,7 @@ EXPORT_SYMBOL(sas_rphy_add); | |||
910 | */ | 903 | */ |
911 | void sas_rphy_free(struct sas_rphy *rphy) | 904 | void sas_rphy_free(struct sas_rphy *rphy) |
912 | { | 905 | { |
906 | struct device *dev = &rphy->dev; | ||
913 | struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); | 907 | struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); |
914 | struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); | 908 | struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); |
915 | 909 | ||
@@ -917,21 +911,9 @@ void sas_rphy_free(struct sas_rphy *rphy) | |||
917 | list_del(&rphy->list); | 911 | list_del(&rphy->list); |
918 | mutex_unlock(&sas_host->lock); | 912 | mutex_unlock(&sas_host->lock); |
919 | 913 | ||
920 | transport_destroy_device(&rphy->dev); | 914 | transport_destroy_device(dev); |
921 | put_device(rphy->dev.parent); | ||
922 | put_device(rphy->dev.parent); | ||
923 | put_device(rphy->dev.parent); | ||
924 | if (rphy->identify.device_type == SAS_END_DEVICE) { | ||
925 | struct sas_end_device *edev = rphy_to_end_device(rphy); | ||
926 | |||
927 | kfree(edev); | ||
928 | } else { | ||
929 | /* must be expander */ | ||
930 | struct sas_expander_device *edev = | ||
931 | rphy_to_expander_device(rphy); | ||
932 | 915 | ||
933 | kfree(edev); | 916 | put_device(dev); |
934 | } | ||
935 | } | 917 | } |
936 | EXPORT_SYMBOL(sas_rphy_free); | 918 | EXPORT_SYMBOL(sas_rphy_free); |
937 | 919 | ||
@@ -971,7 +953,7 @@ sas_rphy_delete(struct sas_rphy *rphy) | |||
971 | 953 | ||
972 | parent->rphy = NULL; | 954 | parent->rphy = NULL; |
973 | 955 | ||
974 | put_device(&parent->dev); | 956 | put_device(dev); |
975 | } | 957 | } |
976 | EXPORT_SYMBOL(sas_rphy_delete); | 958 | EXPORT_SYMBOL(sas_rphy_delete); |
977 | 959 | ||