Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of: unittest: Drop if blocks with always false condition

unittest_gpio_remove() is only called after unittest_gpio_probe() completed
successfully. In this case driver data was set to a non-NULL value and so
platform_get_drvdata() never returns NULL.

Also note that the compiler might optimize away this check anyhow as
devptr was already dereferenced for the dev_dbg call above.

Drop this if block.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230319100620.295849-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Uwe Kleine-König and committed by
Rob Herring
13cd9ac6 5cdade2d

-3
-3
drivers/of/unittest.c
··· 1633 1633 1634 1634 dev_dbg(dev, "%s for node @%pfw\n", __func__, devptr->chip.fwnode); 1635 1635 1636 - if (!devptr) 1637 - return -EINVAL; 1638 - 1639 1636 if (devptr->chip.base != -1) 1640 1637 gpiochip_remove(&devptr->chip); 1641 1638