From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751397AbeA2GVH convert rfc822-to-8bit (ORCPT ); Mon, 29 Jan 2018 01:21:07 -0500 Received: from mx01.hxt-semitech.com.96.203.223.in-addr.arpa ([223.203.96.7]:44524 "EHLO barracuda.hxt-semitech.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751042AbeA2GVF (ORCPT ); Mon, 29 Jan 2018 01:21:05 -0500 X-ASG-Debug-ID: 1517206861-093b7e4305372b0001-xx1T2L X-Barracuda-Envelope-From: shunyong.yang@hxt-semitech.com From: "Yang, Shunyong" To: "vinod.koul@intel.com" CC: "dan.j.williams@intel.com" , "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "awallis@codeaurora.org" , "Zheng, Joey" Subject: Re: [PATCH] dmaengine: dmatest: fix container_of member in dmatest_callback Thread-Topic: [PATCH] dmaengine: dmatest: fix container_of member in dmatest_callback X-ASG-Orig-Subj: Re: [PATCH] dmaengine: dmatest: fix container_of member in dmatest_callback Thread-Index: AQHTk1K7crr1vDON6EG8IuLHBXXE16OJy04AgAAamQA= Date: Mon, 29 Jan 2018 06:21:09 +0000 Message-ID: <1517206860.2845.2.camel@hxt-semitech.com> References: <1516606108-40562-1-git-send-email-shunyong.yang@hxt-semitech.com> <20180129044547.GK18649@localhost> In-Reply-To: <20180129044547.GK18649@localhost> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.64.6.3] Content-Type: text/plain; charset="iso-8859-15" Content-ID: <7E4B5BD4395B7D4286C8CAC7276AE647@hxt-semitech.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Barracuda-Connect: localhost[10.128.0.15] X-Barracuda-Start-Time: 1517206861 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.5000 1.0000 0.0000 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.47360 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Vinod, On Mon, 2018-01-29 at 10:15 +0530, Vinod Koul wrote: > 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); > Thanks. I will send out v2 patch soon. Shunyong