Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1625612
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/3] sata_mv: Use devm_kcalloc() in mv_platform_probe() |
| Date | 2017-04-18 22:10 +0200 |
| Message-ID | <txHBL-22s-3@gated-at.bofh.it> (permalink) |
| References | <txHBL-22s-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 18 Apr 2017 21:36:43 +0200 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "devm_kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data types by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/ata/sata_mv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index b66bcda88320..49abe386c7f6 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -4118,13 +4118,15 @@ static int mv_platform_probe(struct platform_device *pdev) if (!host || !hpriv) return -ENOMEM; - hpriv->port_clks = devm_kzalloc(&pdev->dev, - sizeof(struct clk *) * n_ports, + hpriv->port_clks = devm_kcalloc(&pdev->dev, + n_ports, + sizeof(*hpriv->port_clks), GFP_KERNEL); if (!hpriv->port_clks) return -ENOMEM; - hpriv->port_phys = devm_kzalloc(&pdev->dev, - sizeof(struct phy *) * n_ports, + hpriv->port_phys = devm_kcalloc(&pdev->dev, + n_ports, + sizeof(*hpriv->port_phys), GFP_KERNEL); if (!hpriv->port_phys) return -ENOMEM; -- 2.12.2
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 3/3] sata_mv: Use devm_kcalloc() in mv_platform_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 22:10 +0200
csiph-web