aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/sunvdc.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 8dbbeace52a1..0f5e3caf85d7 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -750,7 +750,7 @@ static struct vio_driver_ops vdc_vio_ops = {
750static int __devinit vdc_port_probe(struct vio_dev *vdev, 750static int __devinit vdc_port_probe(struct vio_dev *vdev,
751 const struct vio_device_id *id) 751 const struct vio_device_id *id)
752{ 752{
753 struct mdesc_node *endp; 753 struct mdesc_handle *hp;
754 struct vdc_port *port; 754 struct vdc_port *port;
755 unsigned long flags; 755 unsigned long flags;
756 struct vdc *vp; 756 struct vdc *vp;
@@ -763,26 +763,24 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev,
763 return -ENODEV; 763 return -ENODEV;
764 } 764 }
765 765
766 endp = vio_find_endpoint(vdev); 766 hp = mdesc_grab();
767 if (!endp) {
768 printk(KERN_ERR PFX "Port lacks channel-endpoint.\n");
769 return -ENODEV;
770 }
771 767
772 port_id = md_get_property(vdev->mp, "id", NULL); 768 port_id = mdesc_get_property(hp, vdev->mp, "id", NULL);
769 err = -ENODEV;
773 if (!port_id) { 770 if (!port_id) {
774 printk(KERN_ERR PFX "Port lacks id property.\n"); 771 printk(KERN_ERR PFX "Port lacks id property.\n");
775 return -ENODEV; 772 goto err_out_release_mdesc;
776 } 773 }
777 if ((*port_id << PARTITION_SHIFT) & ~(u64)MINORMASK) { 774 if ((*port_id << PARTITION_SHIFT) & ~(u64)MINORMASK) {
778 printk(KERN_ERR PFX "Port id [%lu] too large.\n", *port_id); 775 printk(KERN_ERR PFX "Port id [%lu] too large.\n", *port_id);
779 return -ENODEV; 776 goto err_out_release_mdesc;
780 } 777 }
781 778
782 port = kzalloc(sizeof(*port), GFP_KERNEL); 779 port = kzalloc(sizeof(*port), GFP_KERNEL);
780 err = -ENOMEM;
783 if (!port) { 781 if (!port) {
784 printk(KERN_ERR PFX "Cannot allocate vdc_port.\n"); 782 printk(KERN_ERR PFX "Cannot allocate vdc_port.\n");
785 return -ENOMEM; 783 goto err_out_release_mdesc;
786 } 784 }
787 785
788 port->vp = vp; 786 port->vp = vp;
@@ -797,7 +795,7 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev,
797 snprintf(port->disk_name, sizeof(port->disk_name), 795 snprintf(port->disk_name, sizeof(port->disk_name),
798 VDCBLK_NAME "%c", 'a' + (port->dev_no % 26)); 796 VDCBLK_NAME "%c", 'a' + (port->dev_no % 26));
799 797
800 err = vio_driver_init(&port->vio, vdev, VDEV_DISK, endp, 798 err = vio_driver_init(&port->vio, vdev, VDEV_DISK,
801 vdc_versions, ARRAY_SIZE(vdc_versions), 799 vdc_versions, ARRAY_SIZE(vdc_versions),
802 &vdc_vio_ops, port->disk_name); 800 &vdc_vio_ops, port->disk_name);
803 if (err) 801 if (err)
@@ -828,6 +826,8 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev,
828 826
829 dev_set_drvdata(&vdev->dev, port); 827 dev_set_drvdata(&vdev->dev, port);
830 828
829 mdesc_release(hp);
830
831 return 0; 831 return 0;
832 832
833err_out_free_tx_ring: 833err_out_free_tx_ring:
@@ -839,6 +839,8 @@ err_out_free_ldc:
839err_out_free_port: 839err_out_free_port:
840 kfree(port); 840 kfree(port);
841 841
842err_out_release_mdesc:
843 mdesc_release(hp);
842 return err; 844 return err;
843} 845}
844 846