All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Kimberly Brown <kimbrownkd@gmail.com>
Cc: outreachy-kernel@googlegroups.com,
	Rob Springer <rspringer@google.com>,
	Todd Poynor <toddpoynor@google.com>,
	Ben Chan <benchan@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [Outreachy kernel] [PATCH] staging: gasket: interrupt: use sizeof(*p) for memory allocation
Date: Wed, 24 Oct 2018 06:52:29 -0400	[thread overview]
Message-ID: <20181024105229.GA22344@sasha-vm> (raw)
In-Reply-To: <20181024041602.GA2385@v>

On Wed, Oct 24, 2018 at 12:16:02AM -0400, Kimberly Brown wrote:
>Use sizeof(*p) instead of sizeof(struct P) for memory allocation. This
>change complies with the Linux kernel coding style. It improves
>readability and decreases the opportunity for bugs if the pointer
>variable type is changed. Issue found by checkpatch.
>
>Signed-off-by: Kimberly Brown <kimbrownkd@gmail.com>
>---
> drivers/staging/gasket/gasket_interrupt.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/staging/gasket/gasket_interrupt.c b/drivers/staging/gasket/gasket_interrupt.c
>index 49d47afad64f..8353ab50b3ec 100644
>--- a/drivers/staging/gasket/gasket_interrupt.c
>+++ b/drivers/staging/gasket/gasket_interrupt.c
>@@ -322,8 +322,7 @@ int gasket_interrupt_init(struct gasket_dev *gasket_dev)
> 	const struct gasket_driver_desc *driver_desc =
> 		gasket_get_driver_desc(gasket_dev);
>
>-	interrupt_data = kzalloc(sizeof(struct gasket_interrupt_data),
>-				 GFP_KERNEL);
>+	interrupt_data = kzalloc(sizeof(*interrupt_data), GFP_KERNEL);
> 	if (!interrupt_data)
> 		return -ENOMEM;
> 	gasket_dev->interrupt_data = interrupt_data;

This looks great. Maybe you'd like to do the same for the rest of the
function as well?

--
Thanks,
Sasha


  reply	other threads:[~2018-10-24 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  4:16 [PATCH] staging: gasket: interrupt: use sizeof(*p) for memory allocation Kimberly Brown
2018-10-24 10:52 ` Sasha Levin [this message]
2018-10-26  0:04 ` [PATCH v2] staging: gasket: " Kimberly Brown
2018-10-28 19:32   ` Todd Poynor

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=20181024105229.GA22344@sasha-vm \
    --to=sashal@kernel.org \
    --cc=benchan@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kimbrownkd@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=rspringer@google.com \
    --cc=toddpoynor@google.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 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.