[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] scsiback: correct return value checks on xenbus_scanf()


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Fri, 08 Jul 2016 08:44:01 +0000
  • Delivery-date: Fri, 08 Jul 2016 08:44:08 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1467966388 -7200
#      Fri Jul 08 10:26:28 2016 +0200
# Node ID 3e56ca08a5e9c788c03f9ddf707d9d1c4735364f
# Parent  05b894bd0a0fcf83fabfae3f4df6ad3804e1fc52
scsiback: correct return value checks on xenbus_scanf()

Only a positive return value is guaranteed to indicates success.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Juergen Gross <jgross@xxxxxxxx>
---


diff -r 05b894bd0a0f -r 3e56ca08a5e9 drivers/xen/scsiback/xenbus.c
--- a/drivers/xen/scsiback/xenbus.c     Fri Jul 08 10:24:44 2016 +0200
+++ b/drivers/xen/scsiback/xenbus.c     Fri Jul 08 10:26:28 2016 +0200
@@ -133,14 +133,14 @@ static void scsiback_do_lun_hotplug(stru
                snprintf(state_str, sizeof(state_str), "vscsi-devs/%s/state", 
dir[i]);
                err = xenbus_scanf(XBT_NIL, dev->nodename, state_str, "%u",
                        &device_state);
-               if (XENBUS_EXIST_ERR(err))
+               if (err <= 0)
                        continue;
 
                /* physical SCSI device */
                snprintf(str, sizeof(str), "vscsi-devs/%s/p-dev", dir[i]);
                err = xenbus_scanf(XBT_NIL, dev->nodename, str,
                        "%u:%u:%u:%u", &phy.hst, &phy.chn, &phy.tgt, &phy.lun);
-               if (XENBUS_EXIST_ERR(err)) {
+               if (err != 4) {
                        xenbus_printf(XBT_NIL, dev->nodename, state_str,
                                        "%d", XenbusStateClosed);
                        continue;
@@ -150,7 +150,7 @@ static void scsiback_do_lun_hotplug(stru
                snprintf(str, sizeof(str), "vscsi-devs/%s/v-dev", dir[i]);
                err = xenbus_scanf(XBT_NIL, dev->nodename, str,
                        "%u:%u:%u:%u", &vir.hst, &vir.chn, &vir.tgt, &vir.lun);
-               if (XENBUS_EXIST_ERR(err)) {
+               if (err != 4) {
                        xenbus_printf(XBT_NIL, dev->nodename, state_str,
                                        "%d", XenbusStateClosed);
                        continue;
@@ -335,9 +335,8 @@ static int scsiback_probe(struct xenbus_
 
        scsiback_init_translation_table(be->info);
 
-       err = xenbus_scanf(XBT_NIL, dev->nodename,
-                               "feature-host", "%d", &val);
-       if (XENBUS_EXIST_ERR(err))
+       err = xenbus_scanf(XBT_NIL, dev->nodename, "feature-host", "%u", &val);
+       if (err <= 0)
                val = 0;
 
        if (val)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.