aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2018-10-06 13:31:56 +0200
committerStefan Wahren <stefan.wahren@i2se.com>2018-11-14 20:46:18 +0100
commit0829187b17d8019f9bb40c56d47f37b1991a2189 (patch)
tree1b3bb3854edcd832c9ad4b3566c0b2f993e63cb0 /drivers/firmware
parentLinux 4.20-rc1 (diff)
downloadlinux-dev-0829187b17d8019f9bb40c56d47f37b1991a2189.tar.xz
linux-dev-0829187b17d8019f9bb40c56d47f37b1991a2189.zip
firmware: raspberrypi: Define timeout for transactions
We should never assume to get a reply from the firmware otherwise the call could block forever and the user don't get informed. So define a timeout of 1 sec and print a stacktrace once in the unlikely case the timeout expired. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/raspberrypi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index a200a2174611..bf45ac450954 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -56,8 +56,12 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data)
reinit_completion(&fw->c);
ret = mbox_send_message(fw->chan, &message);
if (ret >= 0) {
- wait_for_completion(&fw->c);
- ret = 0;
+ if (wait_for_completion_timeout(&fw->c, HZ)) {
+ ret = 0;
+ } else {
+ ret = -ETIMEDOUT;
+ WARN_ONCE(1, "Firmware transaction timeout");
+ }
} else {
dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret);
}