staging: gpib: gpio: use sizeof(*ptr) in kzalloc
PATCH 1/1 staging: gpib: gpio: use sizeof(*ptr) in kzalloc
Replace sizeof(struct bb_priv) with sizeof(*board->private_data) to follow kernel coding style and improve maintainability.
checkpatch.pl also reports that LINVAL macro should be enclosed in parentheses. However, LINVAL intentionally expands to a comma-separated list of arguments matching the LINFMT format string used in dbg_printk() calls.
Wrapping it in parentheses would change semantics due to the comma operator, causing only the last expression to be passed.
Therefore, no change is made to LINVAL.
--- drivers/staging/gpib/gpio/gpib_bitbang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gpib/gpio/gpib_bitbang.c +1 -1
@@ -1066,7 +1066,7 @@ static int bb_line_status(const struct gpib_board *board)static int allocate_private (struct gpib_board *board) { - board->private_data =kzalloc (sizeof (struct bb_priv ),GFP_KERNEL ); + board->private_data =kzalloc (sizeof (*board->private_data),GFP_KERNEL );if (!board->private_data)return -1 ;return 0 ;
Signature · 1 line
2.43.0
Greg KH
maintainerQuoted 8 lines · Ajanth Badiger
Replace
sizeof(struct bb_priv)withsizeof(*board->private_data)to follow kernel coding style and improve maintainability.checkpatch.pl also reports that LINVAL macro should be enclosed in parentheses. However, LINVAL intentionally expands to a comma-separated list of arguments matching the LINFMT format string used in
dbg_printk()calls.
Quoted 8 lines
Wrapping it in parentheses would change semantics due to the comma operator, causing only the last expression to be passed.
Therefore, no change is made to LINVAL.
Signed-off-by Ajanth Badiger <[email protected]>--- drivers/staging/gpib/gpio/gpib_bitbang.c | 2 +-
This file is not in the tree, what version did you make this against? Please always use linux-next for development work.
thanks,
greg k-h