public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH staging] dgnc: remove useless cast on kzalloc()
@ 2013-09-26  2:12 Fengguang Wu
  2013-09-26 16:27 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Fengguang Wu @ 2013-09-26  2:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Lidza Louina, kbuild-all, linux-kernel

drivers/staging/dgnc/dgnc_driver.c:510:3-7: WARNING: casting value returned by k[cmz]alloc to (char *) is useless.
drivers/staging/dgnc/dgnc_driver.c:502:2-19: WARNING: casting value returned by k[cmz]alloc to (struct dgnc_board *) is useless.

 Casting (void *) value returned by kmalloc is useless
 as mentioned in Documentation/CodingStyle, Chap 14.

Generated by: coccinelle/api/alloc/drop_kmalloc_cast.cocci

CC: Lidza Louina <lidza.louina@gmail.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 drivers/staging/dgnc/dgnc_driver.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-next.orig/drivers/staging/dgnc/dgnc_driver.c	2013-09-26 10:04:27.000000000 +0800
+++ linux-next/drivers/staging/dgnc/dgnc_driver.c	2013-09-26 10:07:56.003128273 +0800
@@ -499,7 +499,7 @@ static int dgnc_found_board(struct pci_d
 
 	/* get the board structure and prep it */
 	brd = dgnc_Board[dgnc_NumBoards] =
-	(struct board_t *) kzalloc(sizeof(struct board_t), GFP_KERNEL);
+		kzalloc(sizeof(struct board_t), GFP_KERNEL);
 	if (!brd) {
 		APR(("memory allocation for board structure failed\n"));
 		return(-ENOMEM);
@@ -507,7 +507,7 @@ static int dgnc_found_board(struct pci_d
 
 	/* make a temporary message buffer for the boot messages */
 	brd->msgbuf = brd->msgbuf_head =
-		(char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL);
+		kzalloc(sizeof(char) * 8192, GFP_KERNEL);
 	if (!brd->msgbuf) {
 		kfree(brd);
 		APR(("memory allocation for board msgbuf failed\n"));

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

* Re: [PATCH staging] dgnc: remove useless cast on kzalloc()
  2013-09-26  2:12 [PATCH staging] dgnc: remove useless cast on kzalloc() Fengguang Wu
@ 2013-09-26 16:27 ` Greg Kroah-Hartman
  2013-09-27  5:09   ` Fengguang Wu
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-26 16:27 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: Lidza Louina, kbuild-all, linux-kernel

On Thu, Sep 26, 2013 at 10:12:23AM +0800, Fengguang Wu wrote:
> drivers/staging/dgnc/dgnc_driver.c:510:3-7: WARNING: casting value returned by k[cmz]alloc to (char *) is useless.
> drivers/staging/dgnc/dgnc_driver.c:502:2-19: WARNING: casting value returned by k[cmz]alloc to (struct dgnc_board *) is useless.
> 
>  Casting (void *) value returned by kmalloc is useless
>  as mentioned in Documentation/CodingStyle, Chap 14.
> 
> Generated by: coccinelle/api/alloc/drop_kmalloc_cast.cocci
> 
> CC: Lidza Louina <lidza.louina@gmail.com>
> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  drivers/staging/dgnc/dgnc_driver.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

As Jingoo sent this a few minutes before you did, and also cleaned up
another cast that you missed, I've added your signed-off-by to his
patch, as they were the same (although yours didn't apply and his
did...)

thanks,

greg k-h

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

* Re: [PATCH staging] dgnc: remove useless cast on kzalloc()
  2013-09-26 16:27 ` Greg Kroah-Hartman
@ 2013-09-27  5:09   ` Fengguang Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Fengguang Wu @ 2013-09-27  5:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Lidza Louina, kbuild-all, linux-kernel

On Thu, Sep 26, 2013 at 09:27:57AM -0700, Greg KH wrote:
> On Thu, Sep 26, 2013 at 10:12:23AM +0800, Fengguang Wu wrote:
> > drivers/staging/dgnc/dgnc_driver.c:510:3-7: WARNING: casting value returned by k[cmz]alloc to (char *) is useless.
> > drivers/staging/dgnc/dgnc_driver.c:502:2-19: WARNING: casting value returned by k[cmz]alloc to (struct dgnc_board *) is useless.
> > 
> >  Casting (void *) value returned by kmalloc is useless
> >  as mentioned in Documentation/CodingStyle, Chap 14.
> > 
> > Generated by: coccinelle/api/alloc/drop_kmalloc_cast.cocci
> > 
> > CC: Lidza Louina <lidza.louina@gmail.com>
> > CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> > ---
> > 
> >  drivers/staging/dgnc/dgnc_driver.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> As Jingoo sent this a few minutes before you did, and also cleaned up
> another cast that you missed, I've added your signed-off-by to his
> patch, as they were the same (although yours didn't apply and his
> did...)

That'd be good, thanks!

Regards,
Fengguang

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

end of thread, other threads:[~2013-09-27  5:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-26  2:12 [PATCH staging] dgnc: remove useless cast on kzalloc() Fengguang Wu
2013-09-26 16:27 ` Greg Kroah-Hartman
2013-09-27  5:09   ` Fengguang Wu

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