]> git.baikalelectronics.ru Git - kernel.git/commit
firmware: Correct handling of fw_state_wait() return value
authorBjorn Andersson <bjorn.andersson@linaro.org>
Wed, 7 Dec 2016 01:01:45 +0000 (17:01 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2016 20:05:54 +0000 (21:05 +0100)
commit0f8157a96d0c1df07fe18d065e2ca6e491855e7f
tree743813f72d14ed2a4b1981fe0a70f3b0466221b4
parent4fa09b32709951e14d093c10ad9e5938b7082b35
firmware: Correct handling of fw_state_wait() return value

When request_firmware() finds an already open firmware object it will
wait for that object to become fully loaded and then check the status.
As __fw_state_wait_common() succeeds the timeout value returned will be
truncated in _request_firmware_prepare() and interpreted as -EPERM.

Prior to "firmware: do not use fw_lock for fw_state protection" the code
did test if we where in the "done" state before sleeping, causing this
particular code path to succeed, in some cases.

As the callers are interested in the result of the wait and not the
remaining timeout the return value of __fw_state_wait_common() is
changed to signal "done" or "error", which simplifies the logic in
_request_firmware_load() as well.

Fixes: 531195f37436 ("firmware: do not use fw_lock for fw_state protection")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c