Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753332AbcLHOr2 (ORCPT ); Thu, 8 Dec 2016 09:47:28 -0500 Received: from cit-hm8-mail01.bmw-carit.de ([212.118.206.84]:43247 "EHLO cit-hm8-gw01.bmw-carit.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752263AbcLHOr0 (ORCPT ); Thu, 8 Dec 2016 09:47:26 -0500 X-CTCH-RefID: str=0001.0A0C0203.5849727B.00FC,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Subject: Re: [PATCH] firwmare: Correct handling of fw_state_wait() return value To: Bjorn Andersson , Ming Lei , "Luis R. Rodriguez" , Greg Kroah-Hartman References: <1481072505-2732-1-git-send-email-bjorn.andersson@linaro.org> CC: , From: Daniel Wagner Message-ID: Date: Thu, 8 Dec 2016 15:47:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1481072505-2732-1-git-send-email-bjorn.andersson@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.10.50.76] X-ClientProxiedBy: CIT-HM8-EX01.bmw-carit.intra (10.40.100.13) To CIT-HM8-EX01.bmw-carit.intra (10.40.100.13) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1070 Lines: 24 On 12/07/2016 02:01 AM, Bjorn Andersson wrote: > 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. Oops, sorry about that one. With your fix the code starts to make sense. > Fixes: 5b029624948d ("firmware: do not use fw_lock for fw_state protection") > Signed-off-by: Bjorn Andersson Reviewed-by: Daniel Wagner Thanks, Daniel