Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp726706img; Fri, 22 Mar 2019 07:21:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6YsWL9Gcj3Fc5Io3Y+9VoetGNirDd4ii0iI8XHwyrtUv8R6pSdL8SQwJwE0S9Sk3Lz4pw X-Received: by 2002:a65:514a:: with SMTP id g10mr9329270pgq.400.1553264483710; Fri, 22 Mar 2019 07:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553264483; cv=none; d=google.com; s=arc-20160816; b=XldSt1KcDplaxNRAkIIAVF/udShQQJgos89uFyG4TXOcW2pyamnKACfoHMwxhTg7JG YUChpoNMsTE0OTY74TisUFJYNHIAUv0wKPdd/eH0iPbWYQlEtGusw1jwzbJac2pmjQGu rNT400qqfVgnKVwozWqFS+eDFCZHSPixTw9+4JpjeqaNnhMhYVSiMtai0pt5mgjetnZ7 yYlSuzK9Aj1/e5jqE3afq7Iw8jLgFWKQJ32W1bdya1zMNazuHX2dEHvGRdtemMW8840O /xF7N/OXY+Yp7MpyH+lDlxUigirLpZOigNmo1bUsz0fmdaEu8polU9l0ZHuKjtPqeE1l slFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XgfETHEWzrkV3WSRhaO0RgtKLHCLeE6X7BTJAYwOe8Y=; b=uNtlS3O7h7L/beTBdZw5UXTxvnf+mzbi7QngN1FeMFQE0HSHeapIsGI/oSdMGMbt9l NnxeRZwKovdoCr0lhP5w8f0zUU2AokA7Y1Mmql1kzfjyWQO4/AKmq19Pc5fQdIjYW6c5 ZryDAbLgOdLZVAk66moXD8CsL92Abp+PeW2VRx9ereL/cZ9vWYu2mJXc8wvBmRPRFzlx aFvhdo7VwNbpPiBg1CQSthGVvJEx7xrh2c+ht/9XA6DLWnd/E0u8B/Xf82o/0hCBZ2nj /VG3C+zzo7OZtjfRU42/Mdvy5z0rRfkWzhS1wVr3FTqFZcIjYiNriW5pPT3eZa7byXl+ QRkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rIpJh4IF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si7178506pfj.70.2019.03.22.07.21.06; Fri, 22 Mar 2019 07:21:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rIpJh4IF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728681AbfCVOTy (ORCPT + 99 others); Fri, 22 Mar 2019 10:19:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:45724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727964AbfCVOTx (ORCPT ); Fri, 22 Mar 2019 10:19:53 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51930218FC; Fri, 22 Mar 2019 14:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553264392; bh=Od4Q0EdlKiuaKntWgiKYJ+qxHG65baKr3t/YYOJ5D/0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rIpJh4IFP0Dabi/CligCKES/9HrbVHSX1z8BmqLwR0s+2AGHxwA8LmbMmpvoZDlhF DWRBbzCt79wtNiCIRO1pUQlLqiJWBAwmqfZJiKPD2ddXrUBsqzIx73A/LuxTnG8XWg SnpM6ddxO2xk6FW/qamt5mMi6Fg6BLq2Rc9NkuUs= Date: Fri, 22 Mar 2019 15:19:49 +0100 From: Greg Kroah-Hartman To: George Hilliard Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/3] staging: mt7621-mmc: Initialize completions a single time during probe Message-ID: <20190322141949.GA23722@kroah.com> References: <20190320224204.10243-1-thirtythreeforty@gmail.com> <20190320224204.10243-3-thirtythreeforty@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190320224204.10243-3-thirtythreeforty@gmail.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 :(