From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dmaengine@vger.kernel.org,
Dan Williams <dan.j.williams@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>, Vinod Koul <vinod.koul@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] dma/ppc4xx: Improve a size determination in ppc440spe_adma_alloc_chan_resources()
Date: Tue, 13 Feb 2018 21:26:32 +0100 [thread overview]
Message-ID: <f6cc6095-0ec6-e9c4-176a-cd6af8c7ec4b@users.sourceforge.net> (raw)
In-Reply-To: <4d9b3ca7-e1bd-42f9-5933-550146812f1e@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 13 Feb 2018 20:54:30 +0100
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/ppc4xx/adma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index f4033367d59b..27ea48a2c1dc 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -1795,8 +1795,7 @@ static int ppc440spe_adma_alloc_chan_resources(struct dma_chan *chan)
db_sz = sizeof(struct xor_cb);
for (; i < (ppc440spe_chan->device->pool_size / db_sz); i++) {
- slot = kzalloc(sizeof(struct ppc440spe_adma_desc_slot),
- GFP_KERNEL);
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL);
if (!slot) {
printk(KERN_INFO "SPE ADMA Channel only initialized"
" %d descriptor slots", i--);
--
2.16.1
prev parent reply other threads:[~2018-02-13 20:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 20:23 [PATCH 0/2] DMA-PPC4xx: Adjustments for three function implementations SF Markus Elfring
2018-02-13 20:25 ` [PATCH 1/2] dma/ppc4xx: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2018-02-13 20:40 ` Joe Perches
2018-02-13 20:26 ` SF Markus Elfring [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6cc6095-0ec6-e9c4-176a-cd6af8c7ec4b@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox