From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] omapfb: Use devm_kcalloc() in vrfb_probe()
Date: Thu, 11 May 2017 15:22:54 +0000 [thread overview]
Message-ID: <2438676.F6TUoaB08n@amdc3058> (raw)
In-Reply-To: <1672837.1nPA5UjCzD@amdc3058>
On Thursday, May 11, 2017 04:27:19 PM Bartlomiej Zolnierkiewicz wrote:
> > @@ -358,11 +358,7 @@ static int __init vrfb_probe(struct platform_device *pdev)
> > return PTR_ERR(vrfb_base);
> >
> > num_ctxs = pdev->num_resources - 1;
> > -
> > - ctxs = devm_kzalloc(&pdev->dev,
> > - sizeof(struct vrfb_ctx) * num_ctxs,
> > - GFP_KERNEL);
> > -
> > + ctxs = devm_kcalloc(&pdev->dev, num_ctxs, sizeof(*ctxs), GFP_KERNEL);
>
> This change makes the resulting binary larger by 24 bytes (probably
> because of the need to have an additional function argument) and
24 bytes seemed too much for just an additional function argument
so I've checked the source:
static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
{
return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
}
static inline void *devm_kmalloc_array(struct device *dev,
size_t n, size_t size, gfp_t flags)
{
if (size != 0 && n > SIZE_MAX / size)
return NULL;
return devm_kmalloc(dev, n * size, flags);
}
static inline void *devm_kcalloc(struct device *dev,
size_t n, size_t size, gfp_t flags)
{
return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
}
The extra kcalloc() checks are inlined currently into each instance.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
next prev parent reply other threads:[~2017-05-11 15:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170426092018epcas4p343e69e32255faa796e7c55c3e89e40f2@epcas4p3.samsung.com>
2017-04-26 9:20 ` [PATCH] omapfb: Use devm_kcalloc() in vrfb_probe() SF Markus Elfring
2017-05-11 14:27 ` Bartlomiej Zolnierkiewicz
2017-05-11 15:22 ` Bartlomiej Zolnierkiewicz [this message]
2017-05-12 7:07 ` Geert Uytterhoeven
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=2438676.F6TUoaB08n@amdc3058 \
--to=b.zolnierkie@samsung.com \
--cc=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tomi.valkeinen@ti.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