diff mbox series

mt76: mt7915: check for devm_pinctrl_get() failure

Message ID 20220307141349.GB18867@kili
State New
Headers show
Series mt76: mt7915: check for devm_pinctrl_get() failure | expand

Commit Message

Dan Carpenter March 7, 2022, 2:13 p.m. UTC
If devm_pinctrl_get() fails then it leads to an error pointer
dereference.  Add a check to prevent that.

Fixes: 99ad32a4ca3a ("mt76: mt7915: add support for MT7986")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/soc.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/soc.c b/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
index 769874820f9b..3028c02cb840 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
@@ -196,6 +196,8 @@  static int mt7986_wmac_gpio_setup(struct mt7915_dev *dev)
 
 	type = mt7986_wmac_check_adie_type(dev);
 	pinctrl = devm_pinctrl_get(dev->mt76.dev);
+	if (IS_ERR(pinctrl))
+		return PTR_ERR(pinctrl);
 
 	switch (type) {
 	case ADIE_SB: