Commit b78a1f37 authored by Paul Bolle's avatar Paul Bolle Committed by Mauro Carvalho Chehab

[media] m920x: let GCC see 'ret' is used initialized

Since commit 7543f344 ("[media] m920x:
factor out a m920x_write_seq() function") building m920x.o triggers this
GCC warning:
    drivers/media/usb/dvb-usb/m920x.c: In function ‘m920x_probe’:
    drivers/media/usb/dvb-usb/m920x.c:91:6: warning: ‘ret’ may be used uninitialized in this function [-Wuninitialized]
This warning is caused by m920x_write_seq(), which is apparently inlined
into m920x_probe(). It is clear why GCC thinks 'ret' may be used
uninitialized. But in practice the first seq->address will always be
non-zero when this function is called. That means we can change the
while()-do{} loop into a do{}-while() loop. And that suffices to make
GCC see that 'ret' will not be used uninitialized.
Signed-off-by: default avatarPaul Bolle <pebolle@tiscali.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 445ba89f
...@@ -68,13 +68,13 @@ static inline int m920x_write_seq(struct usb_device *udev, u8 request, ...@@ -68,13 +68,13 @@ static inline int m920x_write_seq(struct usb_device *udev, u8 request,
struct m920x_inits *seq) struct m920x_inits *seq)
{ {
int ret; int ret;
while (seq->address) { do {
ret = m920x_write(udev, request, seq->data, seq->address); ret = m920x_write(udev, request, seq->data, seq->address);
if (ret != 0) if (ret != 0)
return ret; return ret;
seq++; seq++;
} } while (seq->address);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment