* [PATCH AUTOSEL 4.9 1/3] ASoC: wm8731: Disable the regulator when probing fails
@ 2022-04-26 19:03 Sasha Levin
2022-04-26 19:03 ` [PATCH AUTOSEL 4.9 2/3] drivers: net: hippi: Fix deadlock in rr_close() Sasha Levin
2022-04-26 19:03 ` [PATCH AUTOSEL 4.9 3/3] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Sasha Levin
0 siblings, 2 replies; 3+ messages in thread
From: Sasha Levin @ 2022-04-26 19:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Zheyu Ma, Mark Brown, Sasha Levin, lgirdwood, perex, tiwai,
ckeepax, u.kleine-koenig, patches, alsa-devel
From: Zheyu Ma <zheyuma97@gmail.com>
[ Upstream commit 92ccbf17eeacf510cf1eed9c252d9332ca24f02d ]
When the driver fails during probing, the driver should disable the
regulator, not just handle it in wm8731_hw_init().
The following log reveals it:
[ 17.812483] WARNING: CPU: 1 PID: 364 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0
[ 17.815958] RIP: 0010:_regulator_put+0x3ec/0x4e0
[ 17.824467] Call Trace:
[ 17.824774] <TASK>
[ 17.825040] regulator_bulk_free+0x82/0xe0
[ 17.825514] devres_release_group+0x319/0x3d0
[ 17.825882] i2c_device_probe+0x766/0x940
[ 17.829198] i2c_register_driver+0xb5/0x130
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Link: https://lore.kernel.org/r/20220405121038.4094051-1-zheyuma97@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/wm8731.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 4f9a1eb28120..abe5e77ba171 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -604,7 +604,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
ret = wm8731_reset(wm8731->regmap);
if (ret < 0) {
dev_err(dev, "Failed to issue reset: %d\n", ret);
- goto err_regulator_enable;
+ goto err;
}
/* Clear POWEROFF, keep everything else disabled */
@@ -621,10 +621,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
regcache_mark_dirty(wm8731->regmap);
-err_regulator_enable:
- /* Regulators will be enabled by bias management */
- regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
-
+err:
return ret;
}
@@ -768,21 +765,27 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
ret = PTR_ERR(wm8731->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret);
- return ret;
+ goto err_regulator_enable;
}
ret = wm8731_hw_init(&i2c->dev, wm8731);
if (ret != 0)
- return ret;
+ goto err_regulator_enable;
ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8731, &wm8731_dai, 1);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
- return ret;
+ goto err_regulator_enable;
}
return 0;
+
+err_regulator_enable:
+ /* Regulators will be enabled by bias management */
+ regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
+
+ return ret;
}
static int wm8731_i2c_remove(struct i2c_client *client)
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH AUTOSEL 4.9 2/3] drivers: net: hippi: Fix deadlock in rr_close()
2022-04-26 19:03 [PATCH AUTOSEL 4.9 1/3] ASoC: wm8731: Disable the regulator when probing fails Sasha Levin
@ 2022-04-26 19:03 ` Sasha Levin
2022-04-26 19:03 ` [PATCH AUTOSEL 4.9 3/3] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2022-04-26 19:03 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Duoming Zhou, Paolo Abeni, Sasha Levin, jes, davem, kuba,
linux-hippi, netdev
From: Duoming Zhou <duoming@zju.edu.cn>
[ Upstream commit bc6de2878429e85c1f1afaa566f7b5abb2243eef ]
There is a deadlock in rr_close(), which is shown below:
(Thread 1) | (Thread 2)
| rr_open()
rr_close() | add_timer()
spin_lock_irqsave() //(1) | (wait a time)
... | rr_timer()
del_timer_sync() | spin_lock_irqsave() //(2)
(wait timer to stop) | ...
We hold rrpriv->lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need rrpriv->lock in position (2) of thread 2.
As a result, rr_close() will block forever.
This patch extracts del_timer_sync() from the protection of
spin_lock_irqsave(), which could let timer handler to obtain
the needed lock.
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417125519.82618-1-duoming@zju.edu.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/hippi/rrunner.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
index 6f3519123eb6..0e1a422d9567 100644
--- a/drivers/net/hippi/rrunner.c
+++ b/drivers/net/hippi/rrunner.c
@@ -1354,7 +1354,9 @@ static int rr_close(struct net_device *dev)
rrpriv->fw_running = 0;
+ spin_unlock_irqrestore(&rrpriv->lock, flags);
del_timer_sync(&rrpriv->timer);
+ spin_lock_irqsave(&rrpriv->lock, flags);
writel(0, ®s->TxPi);
writel(0, ®s->IpRxPi);
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH AUTOSEL 4.9 3/3] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
2022-04-26 19:03 [PATCH AUTOSEL 4.9 1/3] ASoC: wm8731: Disable the regulator when probing fails Sasha Levin
2022-04-26 19:03 ` [PATCH AUTOSEL 4.9 2/3] drivers: net: hippi: Fix deadlock in rr_close() Sasha Levin
@ 2022-04-26 19:03 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2022-04-26 19:03 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Zheyu Ma, Damien Le Moal, Sasha Levin, linux-ide
From: Zheyu Ma <zheyuma97@gmail.com>
[ Upstream commit aafa9f958342db36c17ac2a7f1b841032c96feb4 ]
Before detecting the cable type on the dma bar, the driver should check
whether the 'bmdma_addr' is zero, which means the adapter does not
support DMA, otherwise we will get the following error:
[ 5.146634] Bad IO access at port 0x1 (return inb(port))
[ 5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
[ 5.150856] RIP: 0010:ioread8+0x4a/0x60
[ 5.160238] Call Trace:
[ 5.160470] <TASK>
[ 5.160674] marvell_cable_detect+0x6e/0xc0 [pata_marvell]
[ 5.161728] ata_eh_recover+0x3520/0x6cc0
[ 5.168075] ata_do_eh+0x49/0x3c0
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/pata_marvell.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index ff468a6fd8dd..677f582cf3d6 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -82,6 +82,8 @@ static int marvell_cable_detect(struct ata_port *ap)
switch(ap->port_no)
{
case 0:
+ if (!ap->ioaddr.bmdma_addr)
+ return ATA_CBL_PATA_UNK;
if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
return ATA_CBL_PATA40;
return ATA_CBL_PATA80;
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-26 19:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 19:03 [PATCH AUTOSEL 4.9 1/3] ASoC: wm8731: Disable the regulator when probing fails Sasha Levin
2022-04-26 19:03 ` [PATCH AUTOSEL 4.9 2/3] drivers: net: hippi: Fix deadlock in rr_close() Sasha Levin
2022-04-26 19:03 ` [PATCH AUTOSEL 4.9 3/3] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®