* [bug report] ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR
@ 2022-09-16 14:38 Dan Carpenter
2022-09-16 14:40 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-09-16 14:38 UTC (permalink / raw)
To: judyhsiao; +Cc: alsa-devel, linux-rockchip
Hello Judy Hsiao,
The patch fbb0ec656ee5: "ASoC: rockchip: i2s: use
regmap_read_poll_timeout to poll I2S_CLR" from Sep 14, 2022, leads to
the following Smatch static checker warning:
sound/soc/rockchip/rockchip_i2s.c:165 rockchip_snd_txctrl()
warn: sleeping in atomic context
sound/soc/rockchip/rockchip_i2s.c
126 static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on)
127 {
128 unsigned int val = 0;
129 int ret = 0;
130
131 spin_lock(&i2s->lock);
^^^^^^^^^^^^^^^^^^^^^
Holding a spin lock.
132 if (on) {
133 ret = regmap_update_bits(i2s->regmap, I2S_DMACR,
134 I2S_DMACR_TDE_ENABLE,
135 I2S_DMACR_TDE_ENABLE);
136 if (ret < 0)
137 goto end;
138 ret = regmap_update_bits(i2s->regmap, I2S_XFER,
139 I2S_XFER_TXS_START | I2S_XFER_RXS_START,
140 I2S_XFER_TXS_START | I2S_XFER_RXS_START);
141 if (ret < 0)
142 goto end;
143 i2s->tx_start = true;
144 } else {
145 i2s->tx_start = false;
146
147 ret = regmap_update_bits(i2s->regmap, I2S_DMACR,
148 I2S_DMACR_TDE_ENABLE,
149 I2S_DMACR_TDE_DISABLE);
150 if (ret < 0)
151 goto end;
152
153 if (!i2s->rx_start) {
154 ret = regmap_update_bits(i2s->regmap, I2S_XFER,
155 I2S_XFER_TXS_START | I2S_XFER_RXS_START,
156 I2S_XFER_TXS_STOP | I2S_XFER_RXS_STOP);
157 if (ret < 0)
158 goto end;
159 udelay(150);
160 ret = regmap_update_bits(i2s->regmap, I2S_CLR,
161 I2S_CLR_TXC | I2S_CLR_RXC,
162 I2S_CLR_TXC | I2S_CLR_RXC);
163 if (ret < 0)
164 goto end;
--> 165 ret = regmap_read_poll_timeout(i2s->regmap,
166 I2S_CLR,
167 val,
168 val != 0,
169 20,
^^
170 200);
^^^
If the sleep_us or timeout_us values are non-zero then it can sleep so
it's a sleeping in atomic bug.
171 if (ret < 0)
172 dev_warn(i2s->dev, "fail to clear: %d\n", ret);
173 }
174 }
175 end:
176 spin_unlock(&i2s->lock);
177 if (ret < 0)
178 dev_err(i2s->dev, "lrclk update failed\n");
179
180 return ret;
181 }
regards,
dan carpenter
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR
2022-09-16 14:38 [bug report] ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR Dan Carpenter
@ 2022-09-16 14:40 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2022-09-16 14:40 UTC (permalink / raw)
To: judyhsiao; +Cc: alsa-devel, linux-rockchip
On Fri, Sep 16, 2022 at 05:38:09PM +0300, Dan Carpenter wrote:
> Hello Judy Hsiao,
>
> The patch fbb0ec656ee5: "ASoC: rockchip: i2s: use
> regmap_read_poll_timeout to poll I2S_CLR" from Sep 14, 2022, leads to
> the following Smatch static checker warning:
>
> sound/soc/rockchip/rockchip_i2s.c:165 rockchip_snd_txctrl()
> warn: sleeping in atomic context
The code for rx is the same as tx so it has the same warning.
sound/soc/rockchip/rockchip_i2s.c:223 rockchip_snd_rxctrl() warn: sleeping in atomic context
regards,
dan carpenter
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-16 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 14:38 [bug report] ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR Dan Carpenter
2022-09-16 14:40 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).