summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTed Chen <tedc.37zngo@gmail.com>2016-10-30 23:29:20 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-07 11:22:47 +0100
commitc9b32721225b103f3e3fc406600aaaaddc2e8053 (patch)
treee1c62ba41e9dc8975a8d7ecdc8185f8788ec17dc /drivers
parent48157007c8d4374949ed9d3a95e6bf0b8559979e (diff)
staging: comedi: ni_tio: fix warnings of uninitialized variables
Fix the following warnings by initializing these variables to zero and add error check to return early when the check returns an error. drivers/staging/comedi/drivers/ni_tio.c: In function ‘ni_tio_set_sync_mode’: drivers/staging/comedi/drivers/ni_tio.c:492:28: warning: ‘ps’ may be used uninitialized in this function [-Wuninitialized] drivers/staging/comedi/drivers/ni_tio.c: In function ‘ni_tio_insn_config’: drivers/staging/comedi/drivers/ni_tio.c:820:2: warning: ‘temp64’ may be used uninitialized in this function [-Wuninitialized] drivers/staging/comedi/drivers/ni_tio.c:811:6: note: ‘temp64’ was declared her Signed-off-by: Ted Chen <tedc.37zngo@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/drivers/ni_tio.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index 7043eb0543f6..15ca0323ddd9 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -451,8 +451,9 @@ static void ni_tio_set_sync_mode(struct ni_gpct *counter)
unsigned int bits = 0;
unsigned int reg;
unsigned int mode;
- unsigned int clk_src;
- u64 ps;
+ unsigned int clk_src = 0;
+ u64 ps = 0;
+ int ret;
bool force_alt_sync;
/* only m series and 660x variants have counting mode registers */
@@ -482,9 +483,12 @@ static void ni_tio_set_sync_mode(struct ni_gpct *counter)
break;
}
- ni_tio_generic_clock_src_select(counter, &clk_src);
- ni_tio_clock_period_ps(counter, clk_src, &ps);
-
+ ret = ni_tio_generic_clock_src_select(counter, &clk_src);
+ if (ret)
+ return;
+ ret = ni_tio_clock_period_ps(counter, clk_src, &ps);
+ if (ret)
+ return;
/*
* It's not clear what we should do if clock_period is unknown, so we
* are not using the alt sync bit in that case.
@@ -808,7 +812,7 @@ static int ni_tio_get_clock_src(struct ni_gpct *counter,
unsigned int *clock_source,
unsigned int *period_ns)
{
- u64 temp64;
+ u64 temp64 = 0;
int ret;
ret = ni_tio_generic_clock_src_select(counter, clock_source);