media: dvb-usb: opera1: fix uninit-value in dvb_usb_adapter_dvb_init
authorZhang Shurong <zhang_shurong@foxmail.com>
Sun, 9 Jul 2023 05:04:09 +0000 (13:04 +0800)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 19 Jul 2023 10:57:50 +0000 (12:57 +0200)
If opera1_xilinx_rw fails, the mac address is not initialized.
And opera1_read_mac_address does not handle this failure, which leads to
the uninit-value in dvb_usb_adapter_dvb_init.

Fix this by handling the failure of opera1_xilinx_rw.

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/usb/dvb-usb/opera1.c

index 98b2177..d269f8b 100644 (file)
@@ -439,9 +439,14 @@ MODULE_DEVICE_TABLE(usb, opera1_table);
 
 static int opera1_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
 {
+       int ret;
        u8 command[] = { READ_MAC_ADDR };
-       opera1_xilinx_rw(d->udev, 0xb1, 0xa0, command, 1, OPERA_WRITE_MSG);
-       opera1_xilinx_rw(d->udev, 0xb1, 0xa1, mac, 6, OPERA_READ_MSG);
+       ret = opera1_xilinx_rw(d->udev, 0xb1, 0xa0, command, 1, OPERA_WRITE_MSG);
+       if (ret)
+               return ret;
+       ret = opera1_xilinx_rw(d->udev, 0xb1, 0xa1, mac, 6, OPERA_READ_MSG);
+       if (ret)
+               return ret;
        return 0;
 }
 static int opera1_xilinx_load_firmware(struct usb_device *dev,