Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp886410ybl; Wed, 4 Dec 2019 12:38:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzOax8ffzu9jsZgPChGQ4q3pSpP6RmhMD8EzeVOPakS//xpfKteqHk2lQoEtBR7vrEWVWf5 X-Received: by 2002:aca:b2c5:: with SMTP id b188mr4069545oif.55.1575491894314; Wed, 04 Dec 2019 12:38:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575491894; cv=none; d=google.com; s=arc-20160816; b=h5odtupocQ+eKnNw7doOqfMWlBZQkPdHY97hE7C4XzylWaF+bBMgv5iQh6M1s6WNZ+ JQZmJYpdGn7ujedPSkSHejS2oIiOKFGK+kqZEMOsuagTW+FqPqCgl112fjratkYxH2kK dgYRBDKA+om3o2rQhfxudLEqfJz4O2pHvCKEA1Ur5RbqpWP9u3yvDoK09lyyG/1UJ6AM NKi+0L2ukkAcQNyN9FIMXt9+ittg2l7dhua165xWaRSRO2staGWm6hx7KL6VpDeahIVl XeWbAnk4qjxlZ8OcGTnoVgrRWBzkm0vkeEgsxih/G2JDK+NB01S4CFgTxvakxls+xIUN 2w3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=H7MWFI8gSKrKHNd1RvYhm4LP/TyGy+fm/bfIHjZeKuE=; b=pVqybbNmK6zbAY6VsUQkJZqdbTbjuopMajc5waJIT+hdq5lsb6ZpYWrM/YEL65EQmn dSM2Hj32E++jY4GGw9YB93/1vL1RJxxA1IhyGbvHjDMxbKBX2M1eslFhn8vpXK/kbdSz mZ4N7UUDCALlgwSUYHsfh5qSj9cf2dKlGblaw9Kue0gB1iDt3slnbAkJ+QNZCHThIdpI Plk5maWug5et4B3fPO61U1L2hCZZk752YWuJZnwZvwr9yvtFeQL189AVvxTLfaEEmbur swqEDrAKxYSHYVSo/tVTDv5xR3livPl2dFFPzRM9zoeHeHhnnA19uXp7YYTS05BublWc nG3A== ARC-Authentication-Results: i=1; mx.google.com; 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 q7si3792270otg.238.2019.12.04.12.37.59; Wed, 04 Dec 2019 12:38:14 -0800 (PST) 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; 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 S1728271AbfLDUhU (ORCPT + 99 others); Wed, 4 Dec 2019 15:37:20 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:36328 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727911AbfLDUhT (ORCPT ); Wed, 4 Dec 2019 15:37:19 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:1c3::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id EF65414D78C45; Wed, 4 Dec 2019 12:37:18 -0800 (PST) Date: Wed, 04 Dec 2019 12:37:18 -0800 (PST) Message-Id: <20191204.123718.1152659362924451799.davem@davemloft.net> To: grygorii.strashko@ti.com Cc: netdev@vger.kernel.org, ivan.khoronzhuk@linaro.org, nsekhar@ti.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] net: ethernet: ti: davinci_cpdma: fix warning "device driver frees DMA memory with different size" From: David Miller In-Reply-To: <20191204165029.9264-1-grygorii.strashko@ti.com> References: <20191204165029.9264-1-grygorii.strashko@ti.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 04 Dec 2019 12:37:19 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Grygorii Strashko Date: Wed, 4 Dec 2019 18:50:29 +0200 > @@ -1018,7 +1018,7 @@ static int cpdma_chan_submit_si(struct submit_info *si) > struct cpdma_chan *chan = si->chan; > struct cpdma_ctlr *ctlr = chan->ctlr; > int len = si->len; > - int swlen = len; > + int swlen; > struct cpdma_desc __iomem *desc; > dma_addr_t buffer; > u32 mode; > @@ -1040,6 +1040,7 @@ static int cpdma_chan_submit_si(struct submit_info *si) > chan->stats.runt_transmit_buff++; > } > > + swlen = len; > mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP; > cpdma_desc_to_port(chan, mode, si->directed); > > -- > 2.17.1 > Now there is no reason to keep a separate swlen variable. The integral value is always consumed as the length before the descriptor bits are added to it. Therefore you can just use 'len' everywhere in this function now.