From 26fb7c34cba98c08face72cf29b70dfdc71449c6 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Sun, 23 Feb 2020 19:39:25 -0600 Subject: [PATCH] wctdm24xxp: Fix uninitialized variable warning. gcc 10.x detected the following use of an uninitialized variable: ../drivers/dahdi/wctdm24xxp/xhfc.c: In function 'wctdm_init_b400m': ../drivers/dahdi/wctdm24xxp/xhfc.c:624:5: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized] 624 | if (*lastreg != (unsigned char)addr) { | ^ ../drivers/dahdi/wctdm24xxp/xhfc.c:2557:20: note: 'x' was declared here 2557 | unsigned char id, x; | Signed-off-by: Shaun Ruffell --- drivers/dahdi/wctdm24xxp/xhfc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dahdi/wctdm24xxp/xhfc.c b/drivers/dahdi/wctdm24xxp/xhfc.c index d37fbd5..45339f2 100644 --- a/drivers/dahdi/wctdm24xxp/xhfc.c +++ b/drivers/dahdi/wctdm24xxp/xhfc.c @@ -2558,9 +2558,10 @@ static int b400m_probe(struct wctdm *wc, int modpos) struct b400m *b4; unsigned long flags; int chiprev; + u8 lastreg = 0; wctdm_setreg(wc, &wc->mods[modpos], 0x10, 0x10); - id = xhfc_getreg(wc, &wc->mods[modpos], R_CHIP_ID, &x); + id = xhfc_getreg(wc, &wc->mods[modpos], R_CHIP_ID, &lastreg); /* chip ID high 7 bits must be 0x62, see datasheet */ if ((id & 0xfe) != 0x62) @@ -2575,6 +2576,7 @@ static int b400m_probe(struct wctdm *wc, int modpos) /* card found, enabled and main struct allocated. Fill it out. */ b4->wc = wc; + b4->lastreg = lastreg; b4->position = modpos; /* which B400M in the system is this one? count all of them found so