Skip to contentSkip to conversation

drivers: staging: dgnc: Remove useless casting in dgnc_driver.c

PATCH In review Geyslan G. Bem 2 participants 6 messages Oct 16, 2013 – Oct 17, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: staging: dgnc: Remove useless casting in dgnc_driver.c

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

---
 drivers/staging/dgnc/dgnc_driver.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/dgnc/dgnc_driver.c +2 -4
index 71d2b83..7f31ab5 100644
@@ -498,16 +498,14 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 	unsigned long flags;
 
 	/* get the board structure and prep it */
-	brd = dgnc_Board[dgnc_NumBoards] =
-	(struct board_t *) kzalloc(sizeof(struct board_t), GFP_KERNEL);
+	brd = dgnc_Board[dgnc_NumBoards] = kzalloc(sizeof(struct board_t), GFP_KERNEL);
 	if (!brd) {
 		APR(("memory allocation for board structure failed\n"));
 		return(-ENOMEM);
 	}
 
 	/* make a temporary message buffer for the boot messages */
-	brd->msgbuf = brd->msgbuf_head =
-		(char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL);
+	brd->msgbuf = brd->msgbuf_head = kzalloc(sizeof(char) * 8192, GFP_KERNEL);
 	if (!brd->msgbuf) {
 		kfree(brd);
 		APR(("memory allocation for board msgbuf failed\n"));
Signature · 1 line
1.8.4
#1 lore raw

PATCH 1/1 drivers: staging: dgap: Remove useless casting in dgap_parse.c

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

---
 drivers/staging/dgap/dgap_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/dgap/dgap_parse.c +1 -1
index 5497e6d..d41aa1c 100644
@@ -1013,7 +1013,7 @@ static void dgap_err(char *s)
 static struct cnode *dgap_newnode(int t)
 {
 	struct cnode *n;
-	if ( (n = (struct cnode *) kmalloc(sizeof(struct cnode ), GFP_ATOMIC) ) != NULL) {
+	if ( (n = kmalloc(sizeof(struct cnode ), GFP_ATOMIC) ) != NULL) {
 		memset( (char *)n, 0, sizeof(struct cnode ) );
 		n->type = t;
 	}
Signature · 1 line
1.8.4
#2 lore raw

Re: [PATCH] drivers: staging: dgap: Remove useless casting in dgap_parse.c

2013/10/16 Geyslan G. Bem <[email protected]>:

Quoted 22 lines

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

---
 drivers/staging/dgap/dgap_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/dgap/dgap_parse.c +1 -2
index 5497e6d..d41aa1c 100644
@@ -1013,7 +1013,7 @@ static void dgap_err(char *s)
 static struct cnode *dgap_newnode(int t)
 {
        struct cnode *n;
-       if ( (n = (struct cnode *) kmalloc(sizeof(struct cnode ), GFP_ATOMIC) ) != NULL) {
+       if ( (n = kmalloc(sizeof(struct cnode ), GFP_ATOMIC) ) != NULL) {
                memset( (char *)n, 0, sizeof(struct cnode ) );
                n->type = t;
        }
--
Quoted 2 lines

1.8.4

Please, disregard this one. I have compared against staging-next and noted that it was already done by Jingoo Han.

Regards.
Geyslan

maintainer
#3 lore raw
In reply to Geyslan G. Bem
Quoted 7 lines · Geyslan G. Bem

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

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

This patch doesn't apply at all, what tree did you make it against?

Please redo it (and your second one) against either the linux-next releases, or my staging-next branch of my staging.git tree on git.kernel.org.

thanks,

greg k-h

#4 lore raw

2013/10/16 Greg KH <[email protected]>:

Quoted 11 lines · Geyslan G. Bem
Quoted 7 lines

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

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

This patch doesn't apply at all, what tree did you make it against?

Quoted 7 lines

Please redo it (and your second one) against either the linux-next releases, or my staging-next branch of my staging.git tree on git.kernel.org.

thanks,

greg k-h

Hi Greg,

I was using the torvalds tree. I noted that yours is different from his. So, downloading and soon sending the second patch against your staging
(https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/).

Thanks.

Geyslan.

#5 lore raw

2013/10/16 Geyslan Gregório Bem <[email protected]>:

Quoted 22 lines

2013/10/16 Greg KH <[email protected]>:

Quoted 11 lines · Geyslan G. Bem
Quoted 7 lines

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

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

This patch doesn't apply at all, what tree did you make it against?

Quoted 7 lines

Please redo it (and your second one) against either the linux-next releases, or my staging-next branch of my staging.git tree on git.kernel.org.

thanks,

greg k-h

Hi Greg,

Quoted 7 lines

I was using the torvalds tree. I noted that yours is different from his. So, downloading and soon sending the second patch against your staging
(https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/).

Thanks.

Geyslan.

Already done. Patch is unneeded.

Regards.