aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2019-03-07 13:22:21 +0100
committerKalle Valo <kvalo@codeaurora.org>2019-03-19 17:33:33 +0200
commit40b941611bd4826b7e3e449f738af98ad22e1ce6 (patch)
treee6b4907453555d694824893d6a0d08a5b380ab54 /drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
parentmt7601u: check chip version on probe (diff)
downloadwireguard-linux-40b941611bd4826b7e3e449f738af98ad22e1ce6.tar.xz
wireguard-linux-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/mt76x2/usb.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/usb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
index 7a5d539873ca..ac0f13d46299 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
@@ -65,6 +65,10 @@ static int mt76x2u_probe(struct usb_interface *intf,
mdev->rev = mt76_rr(dev, MT_ASIC_VERSION);
dev_info(mdev->dev, "ASIC revision: %08x\n", mdev->rev);
+ if (!is_mt76x2(dev)) {
+ err = -ENODEV;
+ goto err;
+ }
err = mt76x2u_register_device(dev);
if (err < 0)