From: Lior Dotan <liodot@gmail.com>
To: Jiri Slaby <jirislaby@gmail.com>, gregkh@suse.de
Cc: linux-kernel@vger.kernel.org, charrer@alacritech.com
Subject: Re: [STAGING] slicoss - use kzalloc
Date: Wed, 05 Nov 2008 11:27:17 +0200 [thread overview]
Message-ID: <491166F5.7030102@gmail.com> (raw)
In-Reply-To: <4910C63F.7040309@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]
-------- Original Message --------
Subject: Re: [STAGING] slicoss - use kzalloc
From: Jiri Slaby <jirislaby@gmail.com>
To: Lior Dotan <liodot@gmail.com>
CC: gregkh@suse.de, linux-kernel@vger.kernel.org, charrer@alacritech.com
Date: 11/05/2008 12:01 AM
> On 11/04/2008 05:27 PM, Lior Dotan wrote:
>> This patch uses kzalloc() where applicable.
>>
>> Signed-off-by: Lior Dotan <liodot@gmail.com>
>
> /drivers/staging/slicoss/slicoss.c
> =======================================
> --- b/drivers/staging/slicoss/slicoss.c 2008-11-04 11:53:12.878116772 +0200
> +++ a/drivers/staging/slicoss/slicoss.c 2008-11-04 12:08:40.800644774 +0200
> @@ -2673,8 +2673,8 @@
> static·int·slic_card_init(struct·sliccar
> #if·SLIC_DUMP_ENABLED
> » if·(!card->dumpbuffer)·{
> -» » card->dumpbuffer·=·kmalloc(DUMP_PAGE_SIZE,·GFP_ATOMIC);
> +» » card->dumpbuffer·=·kzalloc(DUMP_PAGE_SIZE,·GFP_ATOMIC);
> » » ASSERT(card->dumpbuffer);
> » » if·(card->dumpbuffer·==·NULL)
> @@ -2683,8 +2683,7 @@
> static·int·slic_card_init(struct·sliccar
> » ·*··Smear·the·shared·memory·structure·and·then·obtain
> » ·*··the·PHYSICAL·address·of·this·structure
> » ·*/
> -» memset(card->dumpbuffer,·0,·DUMP_PAGE_SIZE);
>
>
> It's wrong, the function in called multiple times, the memset was called every
> time, now it would be called only for the first time.
You are right, thanks. Here's a fixed version.
This patch uses kzalloc() where really applicable.
Signed-off-by: Lior Dotan <liodot@gmail.com>
[-- Attachment #2: slicoss-kzalloc.patch --]
[-- Type: text/plain, Size: 571 bytes --]
--- b/drivers/staging/slicoss/slicoss.c 2008-11-05 11:21:13.697789873 +0200
+++ a/drivers/staging/slicoss/slicoss.c 2008-11-05 11:24:00.768399196 +0200
@@ -2833,9 +2833,8 @@ static u32 slic_card_locate(struct adapt
}
if (!physcard) {
/* no structure allocated for this physical card yet */
- physcard = kmalloc(sizeof(struct physcard *), GFP_ATOMIC);
+ physcard = kzalloc(sizeof(struct physcard *), GFP_ATOMIC);
ASSERT(physcard);
- memset(physcard, 0, sizeof(struct physcard *));
DBG_MSG
("\n%s Allocate a PHYSICALcard:\n PHYSICAL_Card[%p]\n\
next prev parent reply other threads:[~2008-11-05 9:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-04 16:27 [STAGING] slicoss - use kzalloc Lior Dotan
2008-11-04 22:01 ` Jiri Slaby
2008-11-05 9:27 ` Lior Dotan [this message]
2008-11-05 9:35 ` Jiri Slaby
2008-11-05 9:52 ` Lior Dotan
2008-11-08 14:18 ` Jiri Slaby
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=491166F5.7030102@gmail.com \
--to=liodot@gmail.com \
--cc=charrer@alacritech.com \
--cc=gregkh@suse.de \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.