[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190322141949.GA23722@kroah.com>
Date: Fri, 22 Mar 2019 15:19:49 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: George Hilliard <thirtythreeforty@...il.com>
Cc: linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/3] staging: mt7621-mmc: Initialize completions a
single time during probe
On Wed, Mar 20, 2019 at 04:42:04PM -0600, George Hilliard wrote:
> The module was initializing completions whenever it was going to wait on
> them, and not when the completion was allocated. This is incorrect
> according to the completion docs:
>
> Calling init_completion() on the same completion object twice is
> most likely a bug [...]
>
> Re-initialization is also unnecessary because the module never uses
> complete_all(). Fix this by only ever initializing the completion a
> single time, and log if the completions are not consumed as intended
> (this is not a fatal problem, but should not go unnoticed).
>
> Signed-off-by: George Hilliard <thirtythreeforty@...il.com>
> ---
> v2: Rebased v1
> v3: Removed BUG_ON() calls, and politely log; this failure won't kill us
>
> drivers/staging/mt7621-mmc/sd.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index ff01872ab972..139533606863 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -466,7 +466,10 @@ static unsigned int msdc_command_start(struct msdc_host *host,
> host->cmd = cmd;
> host->cmd_rsp = resp;
>
> - init_completion(&host->cmd_done);
> + // The completion should have been consumed by the previous command
> + // response handler, because the mmc requests should be serialized
> + if(completion_done(&host->cmd_done))
> + dev_err(mmc_dev(host->mmc), "previous command was not handled\n");
Proper coding style please :(
Powered by blists - more mailing lists