[PATCH 1/1] driver/drx39xyj: fix some compiling warnings

From: Li, Zhen-Hua
Date: Sun Sep 21 2014 - 23:23:23 EST


When compiling kernel, in module drx39xyj, there are some warnings
showing some variables may be used uninitialized, though they have
been initialized in fact.

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function
âdrxj_dap_atomic_read_reg32.isra.17â:
drivers/media/dvb-frontends/drx39xyj/drxj.c:2190:7: warning:
â*((void *)&buf+3)â may be used uninitialized in this function
[-Wmaybe-uninitialized]
word = (u32) buf[3];
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:2192:10: warning:
â*((void *)&buf+2)â may be used uninitialized in this function
[-Wmaybe-uninitialized]
word |= (u32) buf[2];
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:2194:10: warning:
â*((void *)&buf+1)â may be used uninitialized in this function
[-Wmaybe-uninitialized]
word |= (u32) buf[1];
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:2196:10: warning:
âbufâ may be used uninitialized in this function [-Wmaybe-uninitialized]
word |= (u32) buf[0];
^
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function
âdrx39xxj_read_statusâ:
drivers/media/dvb-frontends/drx39xyj/drxj.c:10671:11: warning:
âstrengthâ may be used uninitialized in this function [-Wmaybe-uninitialized]
u16 mer, strength;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function
âdrxj_dap_scu_atomic_read_reg16â:
drivers/media/dvb-frontends/drx39xyj/drxj.c:4208:9: warning:
â*((void *)&buf+1)â may be used uninitialized in this function
[-Wmaybe-uninitialized]
word = (u16) (buf[0] + (buf[1] << 8));
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:4208:9: warning:
âbufâ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Li, Zhen-Hua <zhen-hual@xxxxxx>
---
drivers/media/dvb-frontends/drx39xyj/drxj.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c
index 7ca7a21..afb14c70 100644
--- a/drivers/media/dvb-frontends/drx39xyj/drxj.c
+++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c
@@ -2181,6 +2181,7 @@ int drxj_dap_atomic_read_reg32(struct i2c_device_addr *dev_addr,
if (!data)
return -EINVAL;

+ memset(buf, 0, sizeof(*data));
rc = drxj_dap_atomic_read_write_block(dev_addr, addr,
sizeof(*data), buf, true);

@@ -4200,6 +4201,7 @@ int drxj_dap_scu_atomic_read_reg16(struct i2c_device_addr *dev_addr,
if (!data)
return -EINVAL;

+ memset(buf, 0, 2);
rc = drxj_dap_scu_atomic_read_write_block(dev_addr, addr, 2, buf, true);
if (rc < 0)
return rc;
@@ -10667,7 +10669,7 @@ ctrl_sig_quality(struct drx_demod_instance *demod,
enum drx_standard standard = ext_attr->standard;
int rc;
u32 ber, cnt, err, pkt;
- u16 mer, strength;
+ u16 mer, strength = 0;

rc = get_sig_strength(demod, &strength);
if (rc < 0) {
--
2.0.0-rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/