Skip to content

Commit 97438ab

Browse files
SinkFinderdavem330
authored andcommitted
net: dsa: lan9303: correctly check return value of devm_gpiod_get_optional
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 <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3697d05 commit 97438ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/dsa/lan9303-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ static void lan9303_probe_reset_gpio(struct lan9303 *chip,
13011301
chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",
13021302
GPIOD_OUT_LOW);
13031303

1304-
if (!chip->reset_gpio) {
1304+
if (IS_ERR(chip->reset_gpio)) {
13051305
dev_dbg(chip->dev, "No reset GPIO defined\n");
13061306
return;
13071307
}

0 commit comments

Comments
 (0)