From patchwork Mon Jan 29 04:45:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 10189097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6C20660375 for ; Mon, 29 Jan 2018 04:41:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A8E5287C5 for ; Mon, 29 Jan 2018 04:41:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E0D2287C2; Mon, 29 Jan 2018 04:41:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8480028789 for ; Mon, 29 Jan 2018 04:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751175AbeA2ElR (ORCPT ); Sun, 28 Jan 2018 23:41:17 -0500 Received: from mga11.intel.com ([192.55.52.93]:22650 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751127AbeA2ElQ (ORCPT ); Sun, 28 Jan 2018 23:41:16 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2018 20:41:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,429,1511856000"; d="scan'208";a="13773590" Received: from vkoul-udesk7.iind.intel.com (HELO localhost) ([10.223.84.143]) by orsmga008.jf.intel.com with ESMTP; 28 Jan 2018 20:41:13 -0800 Date: Mon, 29 Jan 2018 10:15:48 +0530 From: Vinod Koul To: Yang Shunyong Cc: dan.j.williams@intel.com, awallis@codeaurora.org, yu.zheng@hxt-semitech.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: dmatest: fix container_of member in dmatest_callback Message-ID: <20180129044547.GK18649@localhost> References: <1516606108-40562-1-git-send-email-shunyong.yang@hxt-semitech.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1516606108-40562-1-git-send-email-shunyong.yang@hxt-semitech.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Jan 22, 2018 at 03:28:28PM +0800, Yang Shunyong wrote: > The type of arg passed to dmatest_callback is struct dmatest_done. > It refers to test_done in struct dmatest_thread, not done_wait. > > Fixes: 6f6a23a213be ("dmaengine: dmatest: move callback wait ...") > Signed-off-by: Yang Shunyong > --- > drivers/dma/dmatest.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c > index ec5f9d2bc820..906e85d6dedc 100644 > --- a/drivers/dma/dmatest.c > +++ b/drivers/dma/dmatest.c > @@ -355,7 +355,7 @@ static void dmatest_callback(void *arg) > { > struct dmatest_done *done = arg; > struct dmatest_thread *thread = > - container_of(arg, struct dmatest_thread, done_wait); > + container_of(arg, struct dmatest_thread, test_done); This fixes it but one of the reason why compilers didn't catch this was the void arg. I just tested and used 'done' as the argument here rather than 'arg' and compiler was quick to point out the error. So a better fix IMO would be: -- >8 -- diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index ec5f9d2bc820..80cc2be6483c 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -355,7 +355,7 @@ static void dmatest_callback(void *arg) { struct dmatest_done *done = arg; struct dmatest_thread *thread = - container_of(arg, struct dmatest_thread, done_wait); + container_of(done, struct dmatest_thread, test_done); if (!thread->done) { done->done = true; wake_up_all(done->wait);