History

virtio_ccw: finalize_features error handling

We previously tried to use device even if finalize_features failed, but that's wrong since driver and device are now out of sync. Fail probe if we detect failures during finalize_features.

Cornelia Huck committed 11 years ago

Commit f01a2a81 parent f13d8bc1 file · +10 −6Browse files

Unified · Split

drivers/s390/kvm/virtio_ccw.c+10−6
@@ -757,6 +757,7 @@ static int virtio_ccw_finalize_features(struct virtio_device *vdev) · 756 unmodified lines
757757 struct virtio_ccw_device *vcdev = to_vc_device(vdev);
758758 struct virtio_feature_desc *features;
759759 struct ccw1 *ccw;
760+ int ret;
760761
761762 if (vcdev->revision >= 1 &&
762763 !__virtio_test_bit(vdev, VIRTIO_F_VERSION_1)) {
@@ -767,12 +768,13 @@ static int virtio_ccw_finalize_features(struct virtio_device *vdev) · 4 unmodified lines
767768
768769 ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
769770 if (!ccw)
770− return 0;
771+ return -ENOMEM;
771772
772773 features = kzalloc(sizeof(*features), GFP_DMA | GFP_KERNEL);
773− if (!features)
774+ if (!features) {
775+ ret = -ENOMEM;
774776 goto out_free;
775−
777+ }
776778 /* Give virtio_ring a chance to accept features. */
777779 vring_transport_features(vdev);
778780
@@ -783,7 +785,9 @@ static int virtio_ccw_finalize_features(struct virtio_device *vdev) · 4 unmodified lines
783785 ccw->flags = 0;
784786 ccw->count = sizeof(*features);
785787 ccw->cda = (__u32)(unsigned long)features;
786− ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
788+ ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
789+ if (ret)
790+ goto out_free;
787791
788792 if (vcdev->revision == 0)
789793 goto out_free;
@@ -795,13 +799,13 @@ static int virtio_ccw_finalize_features(struct virtio_device *vdev) · 5 unmodified lines
795799 ccw->flags = 0;
796800 ccw->count = sizeof(*features);
797801 ccw->cda = (__u32)(unsigned long)features;
798− ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
802+ ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
799803
800804 out_free:
801805 kfree(features);
802806 kfree(ccw);
803807
804− return 0;
808+ return ret;
805809 }
806810
807811 static void virtio_ccw_get_config(struct virtio_device *vdev,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t