Skip to content

Commit c5b9b85

Browse files
ribaldaHans Verkuil
authored andcommitted
media: usb: s2255: Refactor s2255_get_fx2fw
Resize the buffer to the actual size needed and initialize it. With this we can convince gcc-11 that the variable is not used uninitialized. drivers/media/usb/s2255/s2255drv.c:1914:25: warning: 'transBuffer' may be used uninitialized [-Wmaybe-uninitialized] Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 8796f33 commit c5b9b85

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/media/usb/s2255/s2255drv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,9 +1906,10 @@ static int s2255_get_fx2fw(struct s2255_dev *dev)
19061906
{
19071907
int fw;
19081908
int ret;
1909-
unsigned char transBuffer[64];
1910-
ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, transBuffer, 2,
1911-
S2255_VR_IN);
1909+
u8 transBuffer[2] = {};
1910+
1911+
ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, transBuffer,
1912+
sizeof(transBuffer), S2255_VR_IN);
19121913
if (ret < 0)
19131914
dprintk(dev, 2, "get fw error: %x\n", ret);
19141915
fw = transBuffer[0] + (transBuffer[1] << 8);

0 commit comments

Comments
 (0)