Merge tag 'for-linus-4.8-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / drivers / block / xen-blkback / xenbus.c
index 3355f1cdd4e5d69db857e985e7c1eb5ec2ee810e..3cc6d1d86f1efc038f451dab3bb3452bed7de92b 100644 (file)
@@ -379,7 +379,7 @@ static struct attribute *xen_vbdstat_attrs[] = {
        NULL
 };
 
-static struct attribute_group xen_vbdstat_group = {
+static const struct attribute_group xen_vbdstat_group = {
        .name = "statistics",
        .attrs = xen_vbdstat_attrs,
 };
@@ -480,7 +480,7 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
        if (q && test_bit(QUEUE_FLAG_WC, &q->queue_flags))
                vbd->flush_support = true;
 
-       if (q && blk_queue_secdiscard(q))
+       if (q && blk_queue_secure_erase(q))
                vbd->discard_secure = true;
 
        pr_debug("Successful creation of handle=%04x (dom=%u)\n",
@@ -715,8 +715,11 @@ static void backend_changed(struct xenbus_watch *watch,
 
        /* Front end dir is a number, which is used as the handle. */
        err = kstrtoul(strrchr(dev->otherend, '/') + 1, 0, &handle);
-       if (err)
+       if (err) {
+               kfree(be->mode);
+               be->mode = NULL;
                return;
+       }
 
        be->major = major;
        be->minor = minor;
@@ -1022,9 +1025,9 @@ static int connect_ring(struct backend_info *be)
        pr_debug("%s %s\n", __func__, dev->otherend);
 
        be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT;
-       err = xenbus_gather(XBT_NIL, dev->otherend, "protocol",
-                           "%63s", protocol, NULL);
-       if (err)
+       err = xenbus_scanf(XBT_NIL, dev->otherend, "protocol",
+                          "%63s", protocol);
+       if (err <= 0)
                strcpy(protocol, "unspecified, assuming default");
        else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE))
                be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE;
@@ -1036,10 +1039,9 @@ static int connect_ring(struct backend_info *be)
                xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
                return -ENOSYS;
        }
-       err = xenbus_gather(XBT_NIL, dev->otherend,
-                           "feature-persistent", "%u",
-                           &pers_grants, NULL);
-       if (err)
+       err = xenbus_scanf(XBT_NIL, dev->otherend,
+                          "feature-persistent", "%u", &pers_grants);
+       if (err <= 0)
                pers_grants = 0;
 
        be->blkif->vbd.feature_gnt_persistent = pers_grants;