[SCSI] scsi_debug: remove temporary hack around sscanf for negative values
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Thu, 20 Mar 2008 02:09:15 +0000 (11:09 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 7 Apr 2008 17:18:58 +0000 (12:18 -0500)
sscanf can handle negative values.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/scsi_debug.c

index 7a2a3edcc723bbcda2621e341669b782ec78be25..2a388d06094a8e771316470c3c0492881c87ecee 100644 (file)
@@ -2681,21 +2681,10 @@ static ssize_t sdebug_add_host_show(struct device_driver * ddp, char * buf)
 static ssize_t sdebug_add_host_store(struct device_driver * ddp,
                                     const char * buf, size_t count)
 {
-        int delta_hosts;
-       char work[20];
+       int delta_hosts;
 
-        if (1 != sscanf(buf, "%10s", work))
+       if (sscanf(buf, "%d", &delta_hosts) != 1)
                return -EINVAL;
-       {       /* temporary hack around sscanf() problem with -ve nums */
-               int neg = 0;
-
-               if ('-' == *work)
-                       neg = 1;
-               if (1 != sscanf(work + neg, "%d", &delta_hosts))
-                       return -EINVAL;
-               if (neg)
-                       delta_hosts = -delta_hosts;
-       }
        if (delta_hosts > 0) {
                do {
                        sdebug_add_adapter();
@@ -2707,7 +2696,7 @@ static ssize_t sdebug_add_host_store(struct device_driver * ddp,
        }
        return count;
 }
-DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, 
+DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show,
            sdebug_add_host_store);
 
 static ssize_t sdebug_vpd_use_hostno_show(struct device_driver * ddp,
This page took 0.028858 seconds and 5 git commands to generate.