From: Dan Carpenter <dan.carpenter@oracle.com>
To: judyhsiao@chromium.org
Cc: linux-rockchip@lists.infradead.org, alsa-devel@alsa-project.org
Subject: [bug report] ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR
Date: Fri, 16 Sep 2022 17:38:09 +0300 [thread overview]
Message-ID: <YySKUQelS41ip5+q@kili> (raw)
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
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: judyhsiao@chromium.org
Cc: alsa-devel@alsa-project.org, linux-rockchip@lists.infradead.org
Subject: [bug report] ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR
Date: Fri, 16 Sep 2022 17:38:09 +0300 [thread overview]
Message-ID: <YySKUQelS41ip5+q@kili> (raw)
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
next reply other threads:[~2022-09-16 14:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 14:38 Dan Carpenter [this message]
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
2022-09-16 14:40 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YySKUQelS41ip5+q@kili \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=judyhsiao@chromium.org \
--cc=linux-rockchip@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.