Skip to contentSkip to conversation

staging/ks7070: Removed unused varibale

PATCH Superseded Bo YU 4 participants 6 messages Feb 23, 2019 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bo YU

author
#0 lore raw

PATCH 1/1 staging/ks7070: Removed unused varibale

From: Bo Yu <[email protected]>

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’ set but not used [-Wunused-but-set-variable]
u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’ set but not used [-Wunused-but-set-variable]

    u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’ set but not used [-Wunused-but-set-variable]

      u16 result_code;

Remove these variables.

Rebase on next-20190222

Cc Greg Kroah-Hartman <[email protected]>
Cc Sergio Paracuellos <[email protected]>
Cc Quytelda Kahja <[email protected]>
---
 drivers/staging/ks7010/ks_hostif.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -6
index d938b0997a53..913d8996437a 100644
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
 	struct net_device *dev = priv->net_dev;
 	u32 mib_status;
 	u32 mib_attribute;
-	u16 mib_val_size;
-	u16 mib_val_type;
 
 	mib_status = get_dword(priv);
 	mib_attribute = get_dword(priv);
-	mib_val_size = get_word(priv);
-	mib_val_type = get_word(priv);
 
 	if (mib_status) {
 		netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-	u16 result_code;
 
-	result_code = get_word(priv);
 	priv->infra_status = 1;	/* infrastructure mode set */
 	hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
 }
Signature · 1 line
2.11.0
#1 lore raw

Hi Bo,

Quoted 59 lines · Bo YU

From: Bo Yu <[email protected]>

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’ set but not used [-Wunused-but-set-variable]
u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’ set but not used [-Wunused-but-set-variable]

    u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’ set but not used [-Wunused-but-set-variable]

      u16 result_code;

Remove these variables.

Rebase on next-20190222

Cc Greg Kroah-Hartman <[email protected]>
Cc Sergio Paracuellos <[email protected]>
Cc Quytelda Kahja <[email protected]>
---
 drivers/staging/ks7010/ks_hostif.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -7
index d938b0997a53..913d8996437a 100644
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
        struct net_device *dev = priv->net_dev;
        u32 mib_status;
        u32 mib_attribute;
-       u16 mib_val_size;
-       u16 mib_val_type;
 
        mib_status = get_dword(priv);
        mib_attribute = get_dword(priv);
-       mib_val_size = get_word(priv);
-       mib_val_type = get_word(priv);
 
        if (mib_status) {
                netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-       u16 result_code;
 
-       result_code = get_word(priv);
        priv->infra_status = 1; /* infrastructure mode set */
        hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
 }
--
Quoted 2 lines

2.11.0

PATCH commit message is wrong: format, typos and driver name:

[PATCH] staging/ks7070: Removed unused varibale

Should be "staging: ks7010: removed unused variables"

Thanks,
Sergio Paracuellos

#2 lore raw
In reply to Bo YU
Quoted 12 lines · Bo YU

From: Bo Yu <[email protected]>

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’ set but not used [-Wunused-but-set-variable]
u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’ set but not used [-Wunused-but-set-variable]

    u16 mib_val_size;
Quoted 7 lines

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’ set but not used [-Wunused-but-set-variable]

      u16 result_code;

Remove these variables.

Rebase on next-20190222

^^^^^^^^^^^^^^^^^^^^^^^
Is this a v2 patch or something? Don't include this in the changelog. Put it under the --- cut off line.

Quoted 7 lines
Cc Greg Kroah-Hartman <[email protected]>
Cc Sergio Paracuellos <[email protected]>
Cc Quytelda Kahja <[email protected]>

---

^^^

Quoted 3 lines
 drivers/staging/ks7010/ks_hostif.c | 6 ------
 1 file changed, 6 deletions(-)

regards,
dan carpenter

maintainer
#3 lore raw
In reply to Bo YU
Quoted 34 lines · Bo YU

From: Bo Yu <[email protected]>

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’ set but not used [-Wunused-but-set-variable]
u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’ set but not used [-Wunused-but-set-variable]

    u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’ set but not used [-Wunused-but-set-variable]

      u16 result_code;

Remove these variables.

Rebase on next-20190222

Cc Greg Kroah-Hartman <[email protected]>
Cc Sergio Paracuellos <[email protected]>
Cc Quytelda Kahja <[email protected]>
---
 drivers/staging/ks7010/ks_hostif.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -0
index d938b0997a53..913d8996437a 100644

drivers/staging/ks7010/ks_hostif.c void hostif_mib_get_confirm(struct ks_wlan_private *priv) · line 470

Quoted 10 lines
drivers/staging/ks7010/ks_hostif.c +0 -4
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
 	struct net_device *dev = priv->net_dev;
 	u32 mib_status;
 	u32 mib_attribute;
-	u16 mib_val_size;
-	u16 mib_val_type;
 
 	mib_status = get_dword(priv);
 	mib_attribute = get_dword(priv);
-	mib_val_size = get_word(priv);
-	mib_val_type = get_word(priv);

The function get_word() actually does something to the priv structure, so you just broke the driver :(

drivers/staging/ks7010/ks_hostif.c void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv) · line 784

Quoted 12 lines
drivers/staging/ks7010/ks_hostif.c +0 -2
 	if (mib_status) {
 		netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-	u16 result_code;
 
-	result_code = get_word(priv);
 	priv->infra_status = 1;	/* infrastructure mode set */
 	hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);

Same here, odds are you just broke things :(

Please be more careful.

greg k-h

author
#4 lore raw
Quoted 58 lines · Greg KH
Quoted 34 lines · Bo YU

From: Bo Yu <[email protected]>

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’ set but not used [-Wunused-but-set-variable]
u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’ set but not used [-Wunused-but-set-variable]

    u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’ set but not used [-Wunused-but-set-variable]

      u16 result_code;

Remove these variables.

Rebase on next-20190222

Cc Greg Kroah-Hartman <[email protected]>
Cc Sergio Paracuellos <[email protected]>
Cc Quytelda Kahja <[email protected]>
---
 drivers/staging/ks7010/ks_hostif.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -0
index d938b0997a53..913d8996437a 100644

drivers/staging/ks7010/ks_hostif.c void hostif_mib_get_confirm(struct ks_wlan_private *priv) · line 470

Quoted 10 lines
drivers/staging/ks7010/ks_hostif.c +0 -4
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
 	struct net_device *dev = priv->net_dev;
 	u32 mib_status;
 	u32 mib_attribute;
-	u16 mib_val_size;
-	u16 mib_val_type;
 
 	mib_status = get_dword(priv);
 	mib_attribute = get_dword(priv);
-	mib_val_size = get_word(priv);
-	mib_val_type = get_word(priv);

The function get_word() actually does something to the priv structure, so you just broke the driver :(

Quoted 9 lines
drivers/staging/ks7010/ks_hostif.c +0 -1
 	if (mib_status) {
 		netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-	u16 result_code;
 
Quoted 7 lines

drivers/staging/ks7010/ks_hostif.c void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv) · line 784

Quoted 3 lines
drivers/staging/ks7010/ks_hostif.c +0 -1
-	result_code = get_word(priv);
 	priv->infra_status = 1;	/* infrastructure mode set */
 	hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);

Same here, odds are you just broke things :(

Please be more careful.

Ok, I have through get_word() and get_byte() before modifing the code.
I think it should be better to encapsulate get_word without return value to do some operations like that? right?

Quoted 2 lines

greg k-h

maintainer
#5 lore raw
Quoted 65 lines · YU Bo
Quoted 64 lines · Greg KH
Quoted 34 lines · Bo YU

From: Bo Yu <[email protected]>

Compiling the kernel with W=1 results in the following warning:

drivers/staging/ks7010/ks_hostif.c:465:6: warning: variable ‘mib_val_type’ set but not used [-Wunused-but-set-variable]
u16 mib_val_type;

drivers/staging/ks7010/ks_hostif.c:464:6: warning: variable ‘mib_val_size’ set but not used [-Wunused-but-set-variable]

    u16 mib_val_size;

drivers/staging/ks7010/ks_hostif.c:786:6: warning: variable ‘result_code’ set but not used [-Wunused-but-set-variable]

      u16 result_code;

Remove these variables.

Rebase on next-20190222

Cc Greg Kroah-Hartman <[email protected]>
Cc Sergio Paracuellos <[email protected]>
Cc Quytelda Kahja <[email protected]>
---
 drivers/staging/ks7010/ks_hostif.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -0
index d938b0997a53..913d8996437a 100644

drivers/staging/ks7010/ks_hostif.c void hostif_mib_get_confirm(struct ks_wlan_private *priv) · line 470

Quoted 10 lines
drivers/staging/ks7010/ks_hostif.c +0 -4
@@ -461,13 +461,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
 	struct net_device *dev = priv->net_dev;
 	u32 mib_status;
 	u32 mib_attribute;
-	u16 mib_val_size;
-	u16 mib_val_type;
 
 	mib_status = get_dword(priv);
 	mib_attribute = get_dword(priv);
-	mib_val_size = get_word(priv);
-	mib_val_type = get_word(priv);

The function get_word() actually does something to the priv structure, so you just broke the driver :(

drivers/staging/ks7010/ks_hostif.c void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv) · line 784

Quoted 12 lines
drivers/staging/ks7010/ks_hostif.c +0 -2
 	if (mib_status) {
 		netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
@@ -783,9 +779,7 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
 static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
-	u16 result_code;
 
-	result_code = get_word(priv);
 	priv->infra_status = 1;	/* infrastructure mode set */
 	hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);

Same here, odds are you just broke things :(

Quoted 4 lines
Quoted 1 line

Please be more careful.

Ok, I have through get_word() and get_byte() before modifing the code.
I think it should be better to encapsulate get_word without return value to do some operations like that? right?

Something should be done, as that api is pretty horrible. But I think that might be a lot more work to accomplish :)

greg k-h