All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: gasket: interrupt: use sizeof(*p) for memory allocation
@ 2018-10-24  4:16 Kimberly Brown
  2018-10-24 10:52 ` [Outreachy kernel] " Sasha Levin
  2018-10-26  0:04 ` [PATCH v2] staging: gasket: " Kimberly Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Kimberly Brown @ 2018-10-24  4:16 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Rob Springer, Todd Poynor, Ben Chan, Greg Kroah-Hartman

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;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-28 19:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-24  4:16 [PATCH] staging: gasket: interrupt: use sizeof(*p) for memory allocation Kimberly Brown
2018-10-24 10:52 ` [Outreachy kernel] " Sasha Levin
2018-10-26  0:04 ` [PATCH v2] staging: gasket: " Kimberly Brown
2018-10-28 19:32   ` Todd Poynor

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.