Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753637AbcLHP2W (ORCPT ); Thu, 8 Dec 2016 10:28:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:51098 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbcLHP2U (ORCPT ); Thu, 8 Dec 2016 10:28:20 -0500 Date: Thu, 8 Dec 2016 16:28:18 +0100 From: "Luis R. Rodriguez" To: Daniel Wagner Cc: Bjorn Andersson , Ming Lei , "Luis R. Rodriguez" , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: Re: [PATCH] firwmare: Correct handling of fw_state_wait() return value Message-ID: <20161208152818.GF1402@wotan.suse.de> References: <1481072505-2732-1-git-send-email-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1218 Lines: 26 On Thu, Dec 08, 2016 at 03:47:22PM +0100, Daniel Wagner wrote: > 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 Acked-by: Luis R. Rodriguez Luis