diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2019-03-07 13:22:21 +0100 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2019-03-19 17:33:33 +0200 |
commit | 40b941611bd4826b7e3e449f738af98ad22e1ce6 (patch) | |
tree | e6b4907453555d694824893d6a0d08a5b380ab54 /drivers/net/wireless/mediatek/mt76/mt76x0 | |
parent | c0316470683af0507427c3e0660246feacdf8363 (diff) | |
download | linux-stable-40b941611bd4826b7e3e449f738af98ad22e1ce6.tar.gz linux-stable-40b941611bd4826b7e3e449f738af98ad22e1ce6.tar.bz2 linux-stable-40b941611bd4826b7e3e449f738af98ad22e1ce6.zip |
mt76x02u: check chip version on probe
Since some USB device IDs are duplicated between mt76x0u, mt7601u
and mt76x2u device, check chip version on probe and return error if
not match the driver.
Don't think this is serious issue, probe most likely will fail at
some other point for wrong device, but we do not have to configure
it if we know is not our device.
Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x0')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c index 91718647da02..e5a06f74a6f7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c @@ -229,7 +229,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf, struct usb_device *usb_dev = interface_to_usbdev(usb_intf); struct mt76x02_dev *dev; struct mt76_dev *mdev; - u32 asic_rev, mac_rev; + u32 mac_rev; int ret; mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), &mt76x0u_ops, @@ -262,10 +262,14 @@ static int mt76x0u_probe(struct usb_interface *usb_intf, goto err; } - asic_rev = mt76_rr(dev, MT_ASIC_VERSION); + mdev->rev = mt76_rr(dev, MT_ASIC_VERSION); mac_rev = mt76_rr(dev, MT_MAC_CSR0); dev_info(mdev->dev, "ASIC revision: %08x MAC revision: %08x\n", - asic_rev, mac_rev); + mdev->rev, mac_rev); + if (!is_mt76x0(dev)) { + ret = -ENODEV; + goto err; + } /* Note: vendor driver skips this check for MT76X0U */ if (!(mt76_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL)) |