From: Ian Abbott Date: Fri, 20 Nov 2009 11:32:37 +0000 (+0000) Subject: Staging: comedi: initialize divisor variables X-Git-Tag: MMI-PSA29.97-13-9~25324^2~177 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=48b1aff5b93521c5ad90842bef52b218ac50a4ab;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git Staging: comedi: initialize divisor variables The i8253_cascade_ns_to_timer_2div() function (and i8253_cascade_ns_to_timer macro) checks the old values *d1 and *d2 for correctness as a heuristic before calculating new values. Don't call the function with uninitialized values in *d1 and *d2. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 1ee4b6a91c1f..791ea8334e1e 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -780,7 +780,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; /* step 1: make sure trigger sources are trivially valid */ diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index f0ae4c06fe95..951e57949f7f 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -830,7 +830,7 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d) static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev, struct comedi_subdevice *s) { - unsigned int divisor1, divisor2; + unsigned int divisor1 = 0, divisor2 = 0; unsigned int seglen; DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_docmd_and_mode(%d,...)\n", @@ -934,7 +934,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cmdtest(...)\n"); #ifdef PCI171X_EXTDEBUG diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index b47b3b1ba350..bc375e73abc1 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -452,7 +452,7 @@ static int das16cs_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->scan_begin_src == TRIG_TIMER) { - unsigned int div1, div2; + unsigned int div1 = 0, div2 = 0; tmp = cmd->scan_begin_arg; i8253_cascade_ns_to_timer(100, &div1, &div2, @@ -462,7 +462,7 @@ static int das16cs_ai_cmdtest(struct comedi_device *dev, err++; } if (cmd->convert_src == TRIG_TIMER) { - unsigned int div1, div2; + unsigned int div1 = 0, div2 = 0; tmp = cmd->convert_arg; i8253_cascade_ns_to_timer(100, &div1, &div2, diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index dd9db069a932..4914784f6995 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -407,6 +407,7 @@ static int pcl711_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * 0xb4 = Select Counter 2 | LSB/MSB | Mode=2 | Binary */ + timer1 = timer2 = 0; i8253_cascade_ns_to_timer(i8253_osc_base, &timer1, &timer2, &cmd->scan_begin_arg, TRIG_ROUND_NEAREST); diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index fa2414500a07..f9a0dac79eca 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -472,7 +472,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; DEBUG(printk("pcl816 pcl812_ai_cmdtest\n"); pcl816_cmdtest_out(-1, cmd); ); diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index e95229b13118..819dd838b075 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -970,7 +970,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; - int divisor1, divisor2; + int divisor1 = 0, divisor2 = 0; unsigned int seglen; printk("pcl818_ai_cmd_mode()\n"); @@ -1089,7 +1089,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, static int pcl818_ao_mode13(int mode, struct comedi_device *dev, struct comedi_subdevice *s, comedi_trig * it) { - int divisor1, divisor2; + int divisor1 = 0, divisor2 = 0; if (!dev->irq) { comedi_error(dev, "IRQ not defined!"); @@ -1287,7 +1287,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; /* step 1: make sure trigger sources are trivially valid */