[OPW,kernel] Staging: vt6655: Fix defined but not used funcitons and variable in ieee80211_crypt.c
diff mbox

Message ID 1382644946-11634-1-git-send-email-ebru.akagunduz@gmail.com
State Changes Requested
Headers show

Commit Message

Ebru Akagündüz Oct. 24, 2013, 8:02 p.m. UTC
This patch fixes the following Sparse Warnings in ieee80211_crypt.c

"ieee80211_crypto_init" defined but not used [-Wunused-function]
"ieee80211_crypto_deinit" defined but not used [-Wunused-function]
"ieee80211_crypt_null" defined but not used [-Wunused-variable]

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
---
 .../staging/rtl8187se/ieee80211/ieee80211_crypt.c  | 60 ----------------------
 1 file changed, 60 deletions(-)

Comments

Rusty Russell Oct. 25, 2013, 12:54 a.m. UTC | #1
Ebru Akagunduz <ebru.akagunduz@gmail.com> writes:
> This patch fixes the following Sparse Warnings in ieee80211_crypt.c
>
> "ieee80211_crypto_init" defined but not used [-Wunused-function]
> "ieee80211_crypto_deinit" defined but not used [-Wunused-function]
> "ieee80211_crypt_null" defined but not used [-Wunused-variable]
>
> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>

I think you made these static in a previous patch, right?

Turns out, that was a mistake: these functions are called from
drivers/staging/rtl8187se/r8180_core.c.

The correct fix is to put these declaration in a header, rather than
declaring them in r8180_core.c:

extern int ieee80211_crypto_init(void);
extern void ieee80211_crypto_deinit(void);
extern int ieee80211_crypto_tkip_init(void);
extern void ieee80211_crypto_tkip_exit(void);
extern int ieee80211_crypto_ccmp_init(void);
extern void ieee80211_crypto_ccmp_exit(void);
extern int ieee80211_crypto_wep_init(void);
extern void ieee80211_crypto_wep_exit(void);

Cheers,
Rusty.

> ---
>  .../staging/rtl8187se/ieee80211/ieee80211_crypt.c  | 60 ----------------------
>  1 file changed, 60 deletions(-)
>
> diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
> index be0a2ed..d67bf0b 100644
> --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
> +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
> @@ -180,63 +180,3 @@ struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name)
>  		return NULL;
>  }
>  
> -
> -static void *ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
> -static void ieee80211_crypt_null_deinit(void *priv) {}
> -
> -static struct ieee80211_crypto_ops ieee80211_crypt_null = {
> -	.name			= "NULL",
> -	.init			= ieee80211_crypt_null_init,
> -	.deinit			= ieee80211_crypt_null_deinit,
> -	.encrypt_mpdu		= NULL,
> -	.decrypt_mpdu		= NULL,
> -	.encrypt_msdu		= NULL,
> -	.decrypt_msdu		= NULL,
> -	.set_key		= NULL,
> -	.get_key		= NULL,
> -	.extra_prefix_len	= 0,
> -	.extra_postfix_len	= 0,
> -	.owner			= THIS_MODULE,
> -};
> -
> -
> -static int ieee80211_crypto_init(void)
> -{
> -	int ret = -ENOMEM;
> -
> -	hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL);
> -	if (!hcrypt)
> -		goto out;
> -
> -	INIT_LIST_HEAD(&hcrypt->algs);
> -	spin_lock_init(&hcrypt->lock);
> -
> -	ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
> -	if (ret < 0) {
> -		kfree(hcrypt);
> -		hcrypt = NULL;
> -	}
> -out:
> -	return ret;
> -}
> -
> -
> -static void ieee80211_crypto_deinit(void)
> -{
> -	struct list_head *ptr, *n;
> -	struct ieee80211_crypto_alg *alg = NULL;
> -
> -	if (hcrypt == NULL)
> -		return;
> -
> -	list_for_each_safe(ptr, n, &hcrypt->algs) {
> -		alg = list_entry(ptr, struct ieee80211_crypto_alg, list);
> -		if (alg) {
> -			list_del(ptr);
> -			pr_debug("unregistered algorithm '%s' (deinit)\n",
> -				 alg->ops->name);
> -			kfree(alg);
> -		}
> -	}
> -	kfree(hcrypt);
> -}
> -- 
> 1.8.1.2
>
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Patch
diff mbox

diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
index be0a2ed..d67bf0b 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
@@ -180,63 +180,3 @@  struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name)
 		return NULL;
 }
 
-
-static void *ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
-
-static struct ieee80211_crypto_ops ieee80211_crypt_null = {
-	.name			= "NULL",
-	.init			= ieee80211_crypt_null_init,
-	.deinit			= ieee80211_crypt_null_deinit,
-	.encrypt_mpdu		= NULL,
-	.decrypt_mpdu		= NULL,
-	.encrypt_msdu		= NULL,
-	.decrypt_msdu		= NULL,
-	.set_key		= NULL,
-	.get_key		= NULL,
-	.extra_prefix_len	= 0,
-	.extra_postfix_len	= 0,
-	.owner			= THIS_MODULE,
-};
-
-
-static int ieee80211_crypto_init(void)
-{
-	int ret = -ENOMEM;
-
-	hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL);
-	if (!hcrypt)
-		goto out;
-
-	INIT_LIST_HEAD(&hcrypt->algs);
-	spin_lock_init(&hcrypt->lock);
-
-	ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
-	if (ret < 0) {
-		kfree(hcrypt);
-		hcrypt = NULL;
-	}
-out:
-	return ret;
-}
-
-
-static void ieee80211_crypto_deinit(void)
-{
-	struct list_head *ptr, *n;
-	struct ieee80211_crypto_alg *alg = NULL;
-
-	if (hcrypt == NULL)
-		return;
-
-	list_for_each_safe(ptr, n, &hcrypt->algs) {
-		alg = list_entry(ptr, struct ieee80211_crypto_alg, list);
-		if (alg) {
-			list_del(ptr);
-			pr_debug("unregistered algorithm '%s' (deinit)\n",
-				 alg->ops->name);
-			kfree(alg);
-		}
-	}
-	kfree(hcrypt);
-}