Skip to content

Commit da62ed5

Browse files
Marek Vasutherbertx
authored andcommitted
hwrng: stm32 - put IP into RPM suspend on failure
In case of an irrecoverable failure, put the IP into RPM suspend to avoid RPM imbalance. I did not trigger this case, but it seems it should be done based on reading the code. Fixes: b17bc6e ("hwrng: stm32 - rework error handling in stm32_rng_read()") Signed-off-by: Marek Vasut <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 31b5778 commit da62ed5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/char/hw_random/stm32-rng.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
220220
if (err && i > RNG_NB_RECOVER_TRIES) {
221221
dev_err((struct device *)priv->rng.priv,
222222
"Couldn't recover from seed error\n");
223-
return -ENOTRECOVERABLE;
223+
retval = -ENOTRECOVERABLE;
224+
goto exit_rpm;
224225
}
225226

226227
continue;
@@ -238,7 +239,8 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
238239
if (err && i > RNG_NB_RECOVER_TRIES) {
239240
dev_err((struct device *)priv->rng.priv,
240241
"Couldn't recover from seed error");
241-
return -ENOTRECOVERABLE;
242+
retval = -ENOTRECOVERABLE;
243+
goto exit_rpm;
242244
}
243245

244246
continue;
@@ -250,6 +252,7 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
250252
max -= sizeof(u32);
251253
}
252254

255+
exit_rpm:
253256
pm_runtime_mark_last_busy((struct device *) priv->rng.priv);
254257
pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv);
255258

0 commit comments

Comments
 (0)