aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_debug.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-03-19 22:09:15 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:18:58 -0400
commitf3df41cff40992499d3c693251622299e4ce18c3 (patch)
tree6bd4714a99f0dfbd6498747dd2715a3a216c6b16 /drivers/scsi/scsi_debug.c
parent1c353f7d616a4ef04b5e73fe7a2184baa039f06f (diff)
[SCSI] scsi_debug: remove temporary hack around sscanf for negative values
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>
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
-rw-r--r--drivers/scsi/scsi_debug.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 7a2a3edcc723..2a388d06094a 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2681,21 +2681,10 @@ static ssize_t sdebug_add_host_show(struct device_driver * ddp, char * buf)
2681static ssize_t sdebug_add_host_store(struct device_driver * ddp, 2681static ssize_t sdebug_add_host_store(struct device_driver * ddp,
2682 const char * buf, size_t count) 2682 const char * buf, size_t count)
2683{ 2683{
2684 int delta_hosts; 2684 int delta_hosts;
2685 char work[20];
2686 2685
2687 if (1 != sscanf(buf, "%10s", work)) 2686 if (sscanf(buf, "%d", &delta_hosts) != 1)
2688 return -EINVAL; 2687 return -EINVAL;
2689 { /* temporary hack around sscanf() problem with -ve nums */
2690 int neg = 0;
2691
2692 if ('-' == *work)
2693 neg = 1;
2694 if (1 != sscanf(work + neg, "%d", &delta_hosts))
2695 return -EINVAL;
2696 if (neg)
2697 delta_hosts = -delta_hosts;
2698 }
2699 if (delta_hosts > 0) { 2688 if (delta_hosts > 0) {
2700 do { 2689 do {
2701 sdebug_add_adapter(); 2690 sdebug_add_adapter();
@@ -2707,7 +2696,7 @@ static ssize_t sdebug_add_host_store(struct device_driver * ddp,
2707 } 2696 }
2708 return count; 2697 return count;
2709} 2698}
2710DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, 2699DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show,
2711 sdebug_add_host_store); 2700 sdebug_add_host_store);
2712 2701
2713static ssize_t sdebug_vpd_use_hostno_show(struct device_driver * ddp, 2702static ssize_t sdebug_vpd_use_hostno_show(struct device_driver * ddp,