staging: dgrp: Remove casting the return value which is a void pointer
PATCH 1/3 staging: dgrp: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.
--- drivers/staging/dgrp/dgrp_sysfs.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/staging/dgrp/dgrp_sysfs.c +15 -15
@@ -157,7 +157,7 @@ static ssize_t dgrp_node_state_show(struct device *c,if (!c)return 0 ; - nd = (struct nd_struct *)dev_get_drvdata (c); + nd =dev_get_drvdata (c);if (!nd)return 0 ;
@@ -174,7 +174,7 @@ static ssize_t dgrp_node_description_show(struct device *c,if (!c)return 0 ; - nd = (struct nd_struct *)dev_get_drvdata (c); + nd =dev_get_drvdata (c);if (!nd)return 0 ;
@@ -192,7 +192,7 @@ static ssize_t dgrp_node_hw_version_show(struct device *c,if (!c)return 0 ; - nd = (struct nd_struct *)dev_get_drvdata (c); + nd =dev_get_drvdata (c);if (!nd)return 0 ;
@@ -212,7 +212,7 @@ static ssize_t dgrp_node_hw_id_show(struct device *c,if (!c)return 0 ; - nd = (struct nd_struct *)dev_get_drvdata (c); + nd =dev_get_drvdata (c);if (!nd)return 0 ;
@@ -232,7 +232,7 @@ static ssize_t dgrp_node_sw_version_show(struct device *c,if (!c)return 0 ; - nd = (struct nd_struct *)dev_get_drvdata (c); + nd =dev_get_drvdata (c);if (!nd)return 0 ;
@@ -311,7 +311,7 @@ static ssize_t dgrp_tty_state_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ;
@@ -328,7 +328,7 @@ static ssize_t dgrp_tty_baud_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -348,7 +348,7 @@ static ssize_t dgrp_tty_msignals_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -377,7 +377,7 @@ static ssize_t dgrp_tty_iflag_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -396,7 +396,7 @@ static ssize_t dgrp_tty_cflag_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -415,7 +415,7 @@ static ssize_t dgrp_tty_oflag_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -434,7 +434,7 @@ static ssize_t dgrp_tty_digi_flag_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -453,7 +453,7 @@ static ssize_t dgrp_tty_rxcount_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -472,7 +472,7 @@ static ssize_t dgrp_tty_txcount_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
@@ -493,7 +493,7 @@ static ssize_t dgrp_tty_name_show(struct device *d,if (!d)return 0 ; - un = (struct un_struct *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un)return 0 ; ch = un->un_ch;
Signature · 1 line
1.7.10.4
PATCH 2/3 staging: dgnc: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.
--- drivers/staging/dgnc/dgnc_driver.c | 4 ++-- drivers/staging/dgnc/dgnc_sysfs.c | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/staging/dgnc/dgnc_driver.c +2 -2
@@ -499,7 +499,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)/* 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_dev *pdev, int id)/* 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" ));
drivers/staging/dgnc/dgnc_sysfs.c +11 -11
@@ -433,7 +433,7 @@ static ssize_t dgnc_tty_state_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -458,7 +458,7 @@ static ssize_t dgnc_tty_baud_show(struct device *d, struct device_attribute *attif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -483,7 +483,7 @@ static ssize_t dgnc_tty_msignals_show(struct device *d, struct device_attributeif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -517,7 +517,7 @@ static ssize_t dgnc_tty_iflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -542,7 +542,7 @@ static ssize_t dgnc_tty_cflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -567,7 +567,7 @@ static ssize_t dgnc_tty_oflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -592,7 +592,7 @@ static ssize_t dgnc_tty_lflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -617,7 +617,7 @@ static ssize_t dgnc_tty_digi_flag_show(struct device *d, struct device_attributeif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -642,7 +642,7 @@ static ssize_t dgnc_tty_rxcount_show(struct device *d, struct device_attribute *if (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -667,7 +667,7 @@ static ssize_t dgnc_tty_txcount_show(struct device *d, struct device_attribute *if (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -692,7 +692,7 @@ static ssize_t dgnc_tty_name_show(struct device *d, struct device_attribute *attif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGNC_UNIT_MAGIC )return (0 ); ch = un->un_ch;
Signature · 1 line
1.7.10.4
'Greg Kroah-Hartman'
maintainerRe: [PATCH 2/3] staging: dgnc: Remove casting the return value which is a void pointer
Quoted 9 lines · Jingoo Han
Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.
Signed-off-by Jingoo Han <[email protected]>--- drivers/staging/dgnc/dgnc_driver.c | 4 ++-- drivers/staging/dgnc/dgnc_sysfs.c | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-)
No longer applies, please refresh against the latest linux-next release.
thanks,
greg k-h
PATCH 3/3 staging: dgap: Remove casting the return value which is a void pointer
In reply to Jingoo HanCasting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.
--- drivers/staging/dgap/dgap_parse.c | 6 ++++-- drivers/staging/dgap/dgap_sysfs.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-)
drivers/staging/dgap/dgap_parse.c +4 -2
@@ -1013,8 +1013,10 @@ 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 ) { -memset ( (char *)n,0 ,sizeof (struct cnode ) ); + + n =kmalloc (sizeof (struct cnode ),GFP_ATOMIC ); +if (n !=NULL ) { +memset ((char *)n,0 ,sizeof (struct cnode )); n->type = t; }return (n);
drivers/staging/dgap/dgap_sysfs.c +11 -11
@@ -395,7 +395,7 @@ static ssize_t dgap_tty_state_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -420,7 +420,7 @@ static ssize_t dgap_tty_baud_show(struct device *d, struct device_attribute *attif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -445,7 +445,7 @@ static ssize_t dgap_tty_msignals_show(struct device *d, struct device_attributeif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -479,7 +479,7 @@ static ssize_t dgap_tty_iflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -504,7 +504,7 @@ static ssize_t dgap_tty_cflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -529,7 +529,7 @@ static ssize_t dgap_tty_oflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -554,7 +554,7 @@ static ssize_t dgap_tty_lflag_show(struct device *d, struct device_attribute *atif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -579,7 +579,7 @@ static ssize_t dgap_tty_digi_flag_show(struct device *d, struct device_attributeif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -604,7 +604,7 @@ static ssize_t dgap_tty_rxcount_show(struct device *d, struct device_attribute *if (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -629,7 +629,7 @@ static ssize_t dgap_tty_txcount_show(struct device *d, struct device_attribute *if (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
@@ -661,7 +661,7 @@ static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *attif (!d)return (0 ); - un = (struct un_t *)dev_get_drvdata (d); + un =dev_get_drvdata (d);if (!un || un->magic !=DGAP_UNIT_MAGIC )return (0 ); ch = un->un_ch;
Signature · 1 line
1.7.10.4