ramips: fix MikroTik 750Gr3 ports MAC addresses
[openwrt/staging/wigyori.git] / target / linux / ramips / patches-5.4 / 0113-staging-mt7621-pci-be-sure-gpio-descriptor-is-null-o.patch
1 From 87068309300c707d659ce79232eae827604804a4 Mon Sep 17 00:00:00 2001
2 From: Sergio Paracuellos <sergio.paracuellos@gmail.com>
3 Date: Fri, 20 Mar 2020 12:01:23 +0100
4 Subject: [PATCH] staging: mt7621-pci: be sure gpio descriptor is null on fails
5
6 Function 'devm_gpiod_get_index_optional' returns NULL if the
7 descriptor is invalid and the error associated for the error
8 pointer is ENOENT. Sometimes if the pin is just assigned the
9 error associated for the pointer might not be ENOENT but other.
10 In order to avoid weirds behaviours if this happen set descriptor
11 to NULL in the driver port structure.
12
13 Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
14 Link: https://lore.kernel.org/r/20200320110123.9907-6-sergio.paracuellos@gmail.com
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 ---
17 drivers/staging/mt7621-pci/pci-mt7621.c | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20 --- a/drivers/staging/mt7621-pci/pci-mt7621.c
21 +++ b/drivers/staging/mt7621-pci/pci-mt7621.c
22 @@ -363,8 +363,10 @@ static int mt7621_pcie_parse_port(struct
23
24 port->gpio_rst = devm_gpiod_get_index_optional(dev, "reset", slot,
25 GPIOD_OUT_LOW);
26 - if (IS_ERR(port->gpio_rst))
27 + if (IS_ERR(port->gpio_rst)) {
28 dev_notice(dev, "Failed to get GPIO for PCIe%d\n", slot);
29 + port->gpio_rst = NULL;
30 + }
31
32 port->slot = slot;
33 port->pcie = pcie;