Skip to contentSkip to conversation

mt7601u: check chip version on probe

PATCH Superseded Stanislaw Gruszka 3 participants 3 messages Mar 7, 2019 – Mar 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mt7601u: check chip version on probe

Since some USB device IDs are duplicated between mt7601u and mt76x0u devices, check chip version on probe and return error if not match 0x7601.

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 mt7601u device.

---
v2: return -ENODEV

 drivers/net/wireless/mediatek/mt7601u/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt7601u/usb.c +4 -0
index d8b7863f7926..be3c794612b2 100644
@@ -303,6 +303,10 @@ static int mt7601u_probe(struct usb_interface *usb_intf,
 	mac_rev = mt7601u_rr(dev, MT_MAC_CSR0);
 	dev_info(dev->dev, "ASIC revision: %08x MAC revision: %08x\n",
 		 asic_rev, mac_rev);
+	if ((asic_rev >> 16) != 0x7601) {
+		ret = -ENODEV;
+		goto err;
+	}
 
 	/* Note: vendor driver skips this check for MT7601U */
 	if (!(mt7601u_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL))
Signature · 1 line
1.9.3
Acked-by on v2 1/1
#1 lore raw
Quoted 10 lines · Stanislaw Gruszka

Since some USB device IDs are duplicated between mt7601u and mt76x0u devices, check chip version on probe and return error if not match 0x7601.

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 mt7601u device.

Thanks!

#2 lore raw
In reply to Stanislaw Gruszka
Quoted 11 lines · Stanislaw Gruszka

Since some USB device IDs are duplicated between mt7601u and mt76x0u devices, check chip version on probe and return error if not match 0x7601.

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 mt7601u device.

Patch applied to wireless-drivers.git, thanks.

c0316470683a mt7601u: check chip version on probe

Signature · 3 lines
https://patchwork.kernel.org/patch/10842757/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches