Re: [PATCH] staging/ks7070: Removed unused varibale

From: YU Bo
Date: Sat Feb 23 2019 - 03:09:47 EST


On Sat, Feb 23, 2019 at 08:43:20AM +0100, Greg KH wrote:
On Sat, Feb 23, 2019 at 01:39:39AM -0500, Bo YU wrote:
From: Bo Yu <tsu.yubo@xxxxxxxxx>

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 <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
Cc: Quytelda Kahja <quytelda@xxxxxxxxxxx>

Signed-off-by: Bo Yu <tsu.yubo@xxxxxxxxx>
---
drivers/staging/ks7010/ks_hostif.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index d938b0997a53..913d8996437a 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -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 :(


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.
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?

greg k-h