diff options
author | Michal Vokáč <michal.vokac@ysoft.com> | 2024-01-26 11:49:35 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-05 20:14:36 +0000 |
commit | 4785948b213fb61375f5fd0e47b7b65a29f7e003 (patch) | |
tree | 2b7fce99eeb98bc1591b2484b76ec476016086fe | |
parent | a4b6f9de6a7892a6708d92ed516a827730ae6c18 (diff) | |
download | linux-stable-4785948b213fb61375f5fd0e47b7b65a29f7e003.tar.gz linux-stable-4785948b213fb61375f5fd0e47b7b65a29f7e003.tar.bz2 linux-stable-4785948b213fb61375f5fd0e47b7b65a29f7e003.zip |
net: dsa: qca8k: fix illegal usage of GPIO
[ Upstream commit c44fc98f0a8ffd94fa0bd291928e7e312ffc7ca4 ]
When working with GPIO, its direction must be set either when the GPIO is
requested by gpiod_get*() or later on by one of the gpiod_direction_*()
functions. Neither of this is done here which results in undefined
behavior on some systems.
As the reset GPIO is used right after it is requested here, it makes sense
to configure it as GPIOD_OUT_HIGH right away. With that, the following
gpiod_set_value_cansleep(1) becomes redundant and can be safely
removed.
Fixes: a653f2f538f9 ("net: dsa: qca8k: introduce reset via gpio feature")
Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/1706266175-3408-1-git-send-email-michal.vokac@ysoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/net/dsa/qca/qca8k-8xxx.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 368d53d3b1d6..17c28fe2d743 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -2049,12 +2049,11 @@ qca8k_sw_probe(struct mdio_device *mdiodev) priv->info = of_device_get_match_data(priv->dev); priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", - GPIOD_ASIS); + GPIOD_OUT_HIGH); if (IS_ERR(priv->reset_gpio)) return PTR_ERR(priv->reset_gpio); if (priv->reset_gpio) { - gpiod_set_value_cansleep(priv->reset_gpio, 1); /* The active low duration must be greater than 10 ms * and checkpatch.pl wants 20 ms. */ |