On Thu, 23 Oct 2014 19:25:01 +0300 "Michael S. Tsirkin" <mst@xxxxxxxxxx> wrote: > Gracefully handle failure to write device status. > We really should handle other errors as well, but this one is needed for > virtio 1.0 compliance. > > Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> > --- > drivers/s390/kvm/virtio_ccw.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c > index a994078..26e737c 100644 > --- a/drivers/s390/kvm/virtio_ccw.c > +++ b/drivers/s390/kvm/virtio_ccw.c > @@ -862,7 +862,9 @@ static u8 virtio_ccw_get_status(struct virtio_device *vdev) > static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status) > { > struct virtio_ccw_device *vcdev = to_vc_device(vdev); > + u8 old_status = vcdev->status; *vcdev->status > struct ccw1 *ccw; > + int ret; > > ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); > if (!ccw) > @@ -874,7 +876,10 @@ static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status) > ccw->flags = 0; > ccw->count = sizeof(status); > ccw->cda = (__u32)(unsigned long)vcdev->status; > - ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_STATUS); > + ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_STATUS); > + /* Write failed? We assume status is unchanged. */ > + if (ret) > + *vcdev->status = old_status; If we fail the write, ccw->cda should be unchanged; but this doesn't hurt. > kfree(ccw); > } > -- To unsubscribe from this list: send the line "unsubscribe linux-s390" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html