staging: rdma: hfi1: Remove casts of pointer to same type
PATCH 1/1 staging: rdma: hfi1: Remove casts of pointer to same type
Casting a pointer to a pointer of the same type is unnecessary, so remove these unnecessary casts.
This was done with Coccinelle:
@@
type T;
T *ptr;
@@
- (T *)ptr
+ ptr
--- drivers/staging/rdma/hfi1/mad.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rdma/hfi1/mad.c +5 -5
@@ -2579,7 +2579,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp,return reply ((struct ib_mad_hdr *)pmp); } - rsp = (struct _port_dctrs *)&(req->port[0 ]); + rsp = &(req->port[0 ]);memset (rsp,0 ,sizeof (*rsp)); rsp->port_number = port;
@@ -2731,7 +2731,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp,return reply ((struct ib_mad_hdr *)pmp); } - rsp = (struct _port_ectrs *)&(req->port[0 ]); + rsp = &(req->port[0 ]); ibp =to_iport (ibdev, port_num); ppd =ppd_from_ibp (ibp);
@@ -2779,7 +2779,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp, tmp =read_dev_cntr (dd,C_DC_UNC_ERR ,CNTR_INVALID_VL ); rsp->uncorrectable_errors = tmp <0x100 ? (tmp &0xff ) :0xff ; - vlinfo = (struct _vls_ectrs *)&(rsp->vls[0 ]); + vlinfo = &(rsp->vls[0 ]); vfi =0 ; vl_select_mask =be32_to_cpu (req->vl_select_mask); for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
@@ -2810,7 +2810,7 @@ static int pma_get_opa_errorinfo(struct opa_pma_mad *pmp,u64 reg; req = (struct opa_port_error_info_msg *)pmp->data; - rsp = (struct _port_ei *)&(req->port[0 ]); + rsp = &(req->port[0 ]); num_ports =OPA_AM_NPORT (be32_to_cpu (pmp->mad_hdr.attr_mod)); num_pslm =hweight64 (be64_to_cpu (req->port_select_mask[3 ]));
@@ -3051,7 +3051,7 @@ static int pma_set_opa_errorinfo(struct opa_pma_mad *pmp,u32 error_info_select; req = (struct opa_port_error_info_msg *)pmp->data; - rsp = (struct _port_ei *)&(req->port[0 ]); + rsp = &(req->port[0 ]); num_ports =OPA_AM_NPORT (be32_to_cpu (pmp->mad_hdr.attr_mod)); num_pslm =hweight64 (be64_to_cpu (req->port_select_mask[3 ]));
--
2.1.4
Quoted 2 lines · Bhaktipriya Shridhar
Casting a pointer to a pointer of the same type is unnecessary, so remove these unnecessary casts.
Maybe you could make a series and get rid of the unnecessary parentheses too.
julia
Quoted 74 lines
This was done with Coccinelle:
@@
type T;
T *ptr;
@@
- (T *)ptr
+ ptrSigned-off-by Bhaktipriya Shridhar <[email protected]>--- drivers/staging/rdma/hfi1/mad.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/staging/rdma/hfi1/mad.c +5
-6@@ -2579,7 +2579,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp,return reply ((struct ib_mad_hdr *)pmp); } - rsp = (struct _port_dctrs *)&(req->port[0 ]); + rsp = &(req->port[0 ]);memset (rsp,0 ,sizeof (*rsp)); rsp->port_number = port;@@ -2731,7 +2731,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp,return reply ((struct ib_mad_hdr *)pmp); } - rsp = (struct _port_ectrs *)&(req->port[0 ]); + rsp = &(req->port[0 ]); ibp =to_iport (ibdev, port_num); ppd =ppd_from_ibp (ibp);@@ -2779,7 +2779,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp, tmp =read_dev_cntr (dd,C_DC_UNC_ERR ,CNTR_INVALID_VL ); rsp->uncorrectable_errors = tmp <0x100 ? (tmp &0xff ) :0xff ; - vlinfo = (struct _vls_ectrs *)&(rsp->vls[0 ]); + vlinfo = &(rsp->vls[0 ]); vfi =0 ; vl_select_mask =be32_to_cpu (req->vl_select_mask); for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),@@ -2810,7 +2810,7 @@ static int pma_get_opa_errorinfo(struct opa_pma_mad *pmp,u64 reg; req = (struct opa_port_error_info_msg *)pmp->data; - rsp = (struct _port_ei *)&(req->port[0 ]); + rsp = &(req->port[0 ]); num_ports =OPA_AM_NPORT (be32_to_cpu (pmp->mad_hdr.attr_mod)); num_pslm =hweight64 (be64_to_cpu (req->port_select_mask[3 ]));@@ -3051,7 +3051,7 @@ static int pma_set_opa_errorinfo(struct opa_pma_mad *pmp,u32 error_info_select; req = (struct opa_port_error_info_msg *)pmp->data; - rsp = (struct _port_ei *)&(req->port[0 ]); + rsp = &(req->port[0 ]); num_ports =OPA_AM_NPORT (be32_to_cpu (pmp->mad_hdr.attr_mod)); num_pslm =hweight64 (be64_to_cpu (req->port_select_mask[3 ])); --2.1.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160225125704.GA7990%40Karyakshetra.
For more options, visit https://groups.google.com/d/optout.