public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style
@ 2025-02-17 12:56 Ravi Kumar kairi
  2025-02-17 12:56 ` [PATCH 1/2] [PATCH 1/2] staging:gpib:hp_82335: Fix error message format for invalid base IO address Ravi Kumar kairi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ravi Kumar kairi @ 2025-02-17 12:56 UTC (permalink / raw)
  To: dpenkler, gregkh, kuba, rmk+kernel, broonie
  Cc: arnd, linux-staging, linux-kernel, Ravi Kumar Kairi

From: Ravi Kumar Kairi <kumarkairiravi@gmail.com>

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(-)

-- 
2.48.1


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

* [PATCH 1/2] [PATCH 1/2] staging:gpib:hp_82335: Fix error message format for invalid base IO address
  2025-02-17 12:56 [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Ravi Kumar kairi
@ 2025-02-17 12:56 ` Ravi Kumar kairi
  2025-02-17 12:56 ` [PATCH 2/2] [PATCH 2/2] staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference Ravi Kumar kairi
  2025-02-19 15:52 ` [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Ravi Kumar kairi @ 2025-02-17 12:56 UTC (permalink / raw)
  To: dpenkler, gregkh, kuba, rmk+kernel, broonie
  Cc: arnd, linux-staging, linux-kernel, Ravi Kumar Kairi

From: Ravi Kumar Kairi <kumarkairiravi@gmail.com>

Updated the error message to correctly format the base IO address using %#x
instead of %u, ensuring it is displayed with a leading '0x'.

Signed-off-by: Ravi Kumar Kairi <kumarkairiravi@gmail.com>
---
 drivers/staging/gpib/hp_82335/hp82335.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gpib/hp_82335/hp82335.c b/drivers/staging/gpib/hp_82335/hp82335.c
index 451d5dc6d3..f1c2045570 100644
--- a/drivers/staging/gpib/hp_82335/hp82335.c
+++ b/drivers/staging/gpib/hp_82335/hp82335.c
@@ -274,7 +274,7 @@ static int hp82335_attach(gpib_board_t *board, const gpib_board_config_t *config
 	case 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")) {
-- 
2.48.1


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

* [PATCH 2/2] [PATCH 2/2] staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference
  2025-02-17 12:56 [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Ravi Kumar kairi
  2025-02-17 12:56 ` [PATCH 1/2] [PATCH 1/2] staging:gpib:hp_82335: Fix error message format for invalid base IO address Ravi Kumar kairi
@ 2025-02-17 12:56 ` Ravi Kumar kairi
  2025-02-18 13:04   ` Dan Carpenter
  2025-02-19 15:52 ` [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Greg KH
  2 siblings, 1 reply; 6+ messages in thread
From: Ravi Kumar kairi @ 2025-02-17 12:56 UTC (permalink / raw)
  To: dpenkler, gregkh, kuba, rmk+kernel, broonie
  Cc: arnd, linux-staging, linux-kernel, Ravi Kumar Kairi

From: Ravi Kumar Kairi <kumarkairiravi@gmail.com>

Replaced sizeof(struct hp82335_priv) with sizeof(*board->private_data)
*as checkpatch* suggested.

Signed-off-by: Ravi Kumar Kairi <kumarkairiravi@gmail.com>
---
 drivers/staging/gpib/hp_82335/hp82335.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gpib/hp_82335/hp82335.c b/drivers/staging/gpib/hp_82335/hp82335.c
index f1c2045570..66557d6964 100644
--- a/drivers/staging/gpib/hp_82335/hp82335.c
+++ b/drivers/staging/gpib/hp_82335/hp82335.c
@@ -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;
-- 
2.48.1


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

* Re: [PATCH 2/2] [PATCH 2/2] staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference
  2025-02-17 12:56 ` [PATCH 2/2] [PATCH 2/2] staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference Ravi Kumar kairi
@ 2025-02-18 13:04   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2025-02-18 13:04 UTC (permalink / raw)
  To: Ravi Kumar kairi
  Cc: dpenkler, gregkh, kuba, rmk+kernel, broonie, arnd, linux-staging,
	linux-kernel

On Mon, Feb 17, 2025 at 06:26:17PM +0530, Ravi Kumar kairi wrote:
> From: Ravi Kumar Kairi <kumarkairiravi@gmail.com>
> 
> Replaced sizeof(struct hp82335_priv) with sizeof(*board->private_data)
> *as checkpatch* suggested.
> 
> Signed-off-by: Ravi Kumar Kairi <kumarkairiravi@gmail.com>
> ---
>  drivers/staging/gpib/hp_82335/hp82335.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gpib/hp_82335/hp82335.c b/drivers/staging/gpib/hp_82335/hp82335.c
> index f1c2045570..66557d6964 100644
> --- a/drivers/staging/gpib/hp_82335/hp82335.c
> +++ b/drivers/staging/gpib/hp_82335/hp82335.c
> @@ -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


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

* Re: [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style
  2025-02-17 12:56 [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Ravi Kumar kairi
  2025-02-17 12:56 ` [PATCH 1/2] [PATCH 1/2] staging:gpib:hp_82335: Fix error message format for invalid base IO address Ravi Kumar kairi
  2025-02-17 12:56 ` [PATCH 2/2] [PATCH 2/2] staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference Ravi Kumar kairi
@ 2025-02-19 15:52 ` Greg KH
  2025-02-19 17:04   ` Ravi Kumar Kairi
  2 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2025-02-19 15:52 UTC (permalink / raw)
  To: Ravi Kumar kairi
  Cc: dpenkler, kuba, rmk+kernel, broonie, arnd, linux-staging,
	linux-kernel

On Mon, Feb 17, 2025 at 06:26:15PM +0530, Ravi Kumar kairi wrote:
> From: Ravi Kumar Kairi <kumarkairiravi@gmail.com>
> 
> 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(-)
> 
> -- 
> 2.48.1
> 
> 

No longer applies to my tree :(

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

* Re: [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style
  2025-02-19 15:52 ` [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Greg KH
@ 2025-02-19 17:04   ` Ravi Kumar Kairi
  0 siblings, 0 replies; 6+ messages in thread
From: Ravi Kumar Kairi @ 2025-02-19 17:04 UTC (permalink / raw)
  To: Greg KH
  Cc: dpenkler, kuba, rmk+kernel, broonie, arnd, linux-staging,
	linux-kernel

On Wed, Feb 19, 2025 at 04:52:13PM +0100, Greg KH wrote:
> On Mon, Feb 17, 2025 at 06:26:15PM +0530, Ravi Kumar kairi wrote:
> > From: Ravi Kumar Kairi <kumarkairiravi@gmail.com>
> > 
> > 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(-)
> > 
> > -- 
> > 2.48.1
> > 
> > 
> 
> No 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

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

end of thread, other threads:[~2025-02-19 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 12:56 [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Ravi Kumar kairi
2025-02-17 12:56 ` [PATCH 1/2] [PATCH 1/2] staging:gpib:hp_82335: Fix error message format for invalid base IO address Ravi Kumar kairi
2025-02-17 12:56 ` [PATCH 2/2] [PATCH 2/2] staging:glib:hp_82335: Refactor kzalloc size calculation to use pointer dereference Ravi Kumar kairi
2025-02-18 13:04   ` Dan Carpenter
2025-02-19 15:52 ` [PATCH 0/2] staging:gpib: Fix error message formatting and adjust memory allocation style Greg KH
2025-02-19 17:04   ` Ravi Kumar Kairi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox