Staging: rtl8712: Remove unnecessary cast on void pointer
authorLucas Tanure <tanure@linux.com>
Wed, 20 Jan 2016 02:52:13 +0000 (00:52 -0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 03:52:30 +0000 (19:52 -0800)
The conversion from void pointer to any other pointer type is guaranteed
by the C programming language.

The semantic patch used to find this:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Lucas Tanure <tanure@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/rtl871x_ioctl_rtl.c

index 7c346a405a20766f193292f4d381266bd381aec1..c7f2e5167cb71a4093e74b5cb5592ff2c320d631 100644 (file)
@@ -49,8 +49,7 @@ uint oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv)
 
 uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -66,8 +65,7 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 
 uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -83,8 +81,7 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 
 uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -115,8 +112,7 @@ uint oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv)
 
 uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -147,8 +143,7 @@ uint oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv *poid_par_priv)
 
 uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -172,8 +167,7 @@ uint oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv
 
 uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
        u32 preamblemode = 0;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
@@ -202,8 +196,7 @@ uint oid_rt_get_ap_ip_hdl(struct oid_par_priv *poid_par_priv)
 
 uint oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
        struct eeprom_priv *peeprompriv = &padapter->eeprompriv;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
@@ -216,8 +209,7 @@ uint oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv)
 uint oid_rt_set_channelplan_hdl(struct oid_par_priv
                                       *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
        struct eeprom_priv *peeprompriv = &padapter->eeprompriv;
 
        if (poid_par_priv->type_of_oid != SET_OID)
@@ -229,8 +221,7 @@ uint oid_rt_set_channelplan_hdl(struct oid_par_priv
 uint oid_rt_set_preamble_mode_hdl(struct oid_par_priv
                                         *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
        u32 preamblemode = 0;
 
        if (poid_par_priv->type_of_oid != SET_OID)
@@ -267,8 +258,7 @@ uint oid_rt_dedicate_probe_hdl(struct oid_par_priv
 uint oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv
                                          *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -285,8 +275,7 @@ uint oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv
 uint oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv
                                          *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != QUERY_OID)
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -325,8 +314,7 @@ uint oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv
 
 uint oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                   (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
        struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
        struct NDIS_802_11_CONFIGURATION *pnic_Config;
        u32   channelnum;
@@ -449,8 +437,7 @@ uint oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv*
                                             poid_par_priv)
 {
        uint status = RNDIS_STATUS_SUCCESS;
-       struct _adapter *Adapter = (struct _adapter *)
-                       (poid_par_priv->adapter_context);
+       struct _adapter *Adapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != SET_OID) /* QUERY_OID */
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -470,8 +457,7 @@ uint oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv*
 uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
 {
        uint status = RNDIS_STATUS_SUCCESS;
-       struct _adapter *Adapter = (struct _adapter *)
-                       (poid_par_priv->adapter_context);
+       struct _adapter *Adapter = poid_par_priv->adapter_context;
 
        if (poid_par_priv->type_of_oid != SET_OID) /* QUERY_OID */
                return RNDIS_STATUS_NOT_ACCEPTED;
@@ -516,8 +502,7 @@ enum _CONNECT_STATE_ {
 
 uint oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv)
 {
-       struct _adapter *padapter = (struct _adapter *)
-                                    (poid_par_priv->adapter_context);
+       struct _adapter *padapter = poid_par_priv->adapter_context;
        struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
        u32 ulInfo;