mirror of
https://github.com/torvalds/linux.git
synced 2024-12-07 03:21:32 +00:00
staging: mt7621-pci: be sure gpio descriptor is null on fails
Function 'devm_gpiod_get_index_optional' returns NULL if the descriptor is invalid and the error associated for the error pointer is ENOENT. Sometimes if the pin is just assigned the error associated for the pointer might not be ENOENT but other. In order to avoid weirds behaviours if this happen set descriptor to NULL in the driver port structure. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Link: https://lore.kernel.org/r/20200320110123.9907-6-sergio.paracuellos@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7846a98285
commit
825c6f470c
@ -363,8 +363,10 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
|
||||
|
||||
port->gpio_rst = devm_gpiod_get_index_optional(dev, "reset", slot,
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(port->gpio_rst))
|
||||
if (IS_ERR(port->gpio_rst)) {
|
||||
dev_notice(dev, "Failed to get GPIO for PCIe%d\n", slot);
|
||||
port->gpio_rst = NULL;
|
||||
}
|
||||
|
||||
port->slot = slot;
|
||||
port->pcie = pcie;
|
||||
|
Loading…
Reference in New Issue
Block a user