]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: dsa: lan9303: correctly check return value of devm_gpiod_get_optional
authorPan Bian <bianpan2016@163.com>
Sun, 12 Nov 2017 15:38:09 +0000 (23:38 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Nov 2017 12:34:57 +0000 (21:34 +0900)
Function devm_gpiod_get_optional() returns an ERR_PTR on failure. Its
return value should not be validated by a NULL check. Instead, use IS_ERR.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/lan9303-core.c

index fdfdb0edfe624eef313edaf42ec1aebd1caf910b..b24566bb74d2b789d821ca35d995001b3db3c8ae 100644 (file)
@@ -1301,7 +1301,7 @@ static void lan9303_probe_reset_gpio(struct lan9303 *chip,
        chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",
                                                   GPIOD_OUT_LOW);
 
-       if (!chip->reset_gpio) {
+       if (IS_ERR(chip->reset_gpio)) {
                dev_dbg(chip->dev, "No reset GPIO defined\n");
                return;
        }