staging:gpib: Fix error message formatting and adjust memory allocation style
cover staging:gpib: Fix error message formatting and adjust memory allocation style
From: Ravi Kumar Kairi <[email protected]>
This patch series includes two minor improvements:
1. Updates the error message format for invalid base I/O addresses to use hexadecimal notation.
2. Changes the memory allocation style for private_data to use pointer dereference rather than hardcoding the struct type. which is perfered by checkpatch.
Ravi Kumar Kairi (2):
staging:gpib:hp_82335: Fix error message format for invalid base IO
address
staging:glib:hp_82335: Refactor kzalloc size calculation to use
pointer dereference
drivers/staging/gpib/hp_82335/hp82335.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/2 staging:gpib:hp_82335: Fix error message format for invalid base IO address
From: Ravi Kumar Kairi <[email protected]>
Updated the error message to correctly format the base IO address using %#x instead of %u, ensuring it is displayed with a leading '0x'.
--- drivers/staging/gpib/hp_82335/hp82335.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gpib/hp_82335/hp82335.c +1 -1
@@ -274,7 +274,7 @@ static int hp82335_attach(gpib_board_t *board, const gpib_board_config_t *configcase 0xfc000 :break ;default : -pr_err ("hp82335: invalid base io address 0x%u\n" , config->ibbase); +pr_err ("hp82335: invalid base io address 0x%#x\n" , config->ibbase);return -EINVAL ; }if (!request_mem_region (upper_iomem_base, hp82335_upper_iomem_size,"hp82335" )) {
Signature · 1 line
2.48.1
PATCH 2/2 staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference
In reply to Ravi Kumar kairiFrom: Ravi Kumar Kairi <[email protected]>
Replaced sizeof(struct hp82335_priv) with sizeof(*board->private_data) *as checkpatch* suggested.
--- drivers/staging/gpib/hp_82335/hp82335.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gpib/hp_82335/hp82335.c +1 -1
@@ -205,7 +205,7 @@ static gpib_interface_t hp82335_interface = {static int hp82335_allocate_private (gpib_board_t *board) { - board->private_data =kzalloc (sizeof (struct hp82335_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.48.1
Re: [PATCH 2/2] [PATCH 2/2] staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference
Quoted 15 lines · Ravi Kumar kairi
From: Ravi Kumar Kairi <[email protected]>
Replaced
sizeof(struct hp82335_priv)withsizeof(*board->private_data)*as checkpatch* suggested.Signed-off-by Ravi Kumar Kairi <[email protected]>--- drivers/staging/gpib/hp_82335/hp82335.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/gpib/hp_82335/hp82335.c +0
-0
drivers/staging/gpib/hp_82335/hp82335.c static gpib_interface_t hp82335_interface = { · line 208
Quoted 5 lines
drivers/staging/gpib/hp_82335/hp82335.c +1
-1@@ -205,7 +205,7 @@ static gpib_interface_t hp82335_interface = {static int hp82335_allocate_private (gpib_board_t *board) { - board->private_data =kzalloc (sizeof (struct hp82335_priv ),GFP_KERNEL ); + board->private_data =kzalloc (sizeof (*board->private_data),GFP_KERNEL );
No, this doesn't work. board->private_data is a void pointer.
I recently wrote a Smatch check for this kind of bug, but I was letting someone send all the fixes before I publish it.
regards,
dan carpenter
Greg KH
maintainerQuoted 7 lines · Ravi Kumar kairi
From: Ravi Kumar Kairi <[email protected]>
This patch series includes two minor improvements:
1. Updates the error message format for invalid base I/O addresses to use hexadecimal notation.
2. Changes the memory allocation style forprivate_datato use pointer dereference rather than hardcoding the struct type. which is perfered by checkpatch.
Quoted 13 lines
Ravi Kumar Kairi (2):
staging:gpib:hp_82335: Fix error message format for invalid base IO
address
staging:glib:hp_82335: Refactor kzalloc size calculation to use
pointer dereferencedrivers/staging/gpib/hp_82335/hp82335.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Signature · 1 line
2.48.1
No longer applies to my tree :(
Quoted 17 lines · Greg KH
Quoted 16 lines · Ravi Kumar kairi
From: Ravi Kumar Kairi <[email protected]>
This patch series includes two minor improvements:
1. Updates the error message format for invalid base I/O addresses to use hexadecimal notation.
2. Changes the memory allocation style forprivate_datato use pointer dereference rather than hardcoding the struct type. which is perfered by checkpatch.Ravi Kumar Kairi (2):
staging:gpib:hp_82335: Fix error message format for invalid base IO
address
staging:glib:hp_82335: Refactor kzalloc size calculation to use
pointer dereferencedrivers/staging/gpib/hp_82335/hp82335.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 4 lines
Signature · 1 line
2.48.1No longer applies to my tree :(
yeah, I you applied another patch that fixes same issues, I just noticed it, guess I was late. anyway have a great night/day.
regards,
Ravi