All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] staging/gdm72xx: Include corresponding header file (fix sparse warning)
@ 2013-02-19 17:50 Peter Huewe
  2013-02-19 17:50 ` [PATCH 2/3] staging/gdm72xx: Remove unused variable in gdm_qos.c Peter Huewe
  2013-02-19 17:50 ` [PATCH 3/3] staging/gdm72xx: Remove duplicated code " Peter Huewe
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Huewe @ 2013-02-19 17:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: David S. Miller, Pablo Neira Ayuso, Stephen Hemminger,
	Eric W. Biederman, Sage Ahn, Macpaul Lin, YAMANE Toshiaki,
	Devendra Naga, devel, linux-kernel, Peter Huewe

sdio_boot.c and netlink_k.c both have a corresponding header file with
their function prototypes but fail to include them, which leads to the
following sparse warnings:
sdio_boot.c:135:5: warning: symbol 'sdio_boot' was not declared. Should it be static?
netlink_k.c:89:13: warning: symbol 'netlink_init' was not declared. Should it be static?
netlink_k.c:109:6: warning: symbol 'netlink_exit' was not declared. Should it be static?
netlink_k.c:114:5: warning: symbol 'netlink_send' was not declared. Should it be static?

-> Add the include files and silence the warning

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/gdm72xx/netlink_k.c |    1 +
 drivers/staging/gdm72xx/sdio_boot.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c
index 52c25ba..8a92605 100644
--- a/drivers/staging/gdm72xx/netlink_k.c
+++ b/drivers/staging/gdm72xx/netlink_k.c
@@ -18,6 +18,7 @@
 #include <linux/netlink.h>
 #include <asm/byteorder.h>
 #include <net/sock.h>
+#include "netlink_k.h"
 
 #if !defined(NLMSG_HDRLEN)
 #define NLMSG_HDRLEN	 ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
diff --git a/drivers/staging/gdm72xx/sdio_boot.c b/drivers/staging/gdm72xx/sdio_boot.c
index 93046dd..4302fcb 100644
--- a/drivers/staging/gdm72xx/sdio_boot.c
+++ b/drivers/staging/gdm72xx/sdio_boot.c
@@ -27,6 +27,7 @@
 #include <linux/firmware.h>
 
 #include "gdm_sdio.h"
+#include "sdio_boot.h"
 
 #define TYPE_A_HEADER_SIZE	4
 #define TYPE_A_LOOKAHEAD_SIZE   16
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] staging/gdm72xx: Remove unused variable in gdm_qos.c
  2013-02-19 17:50 [PATCH 1/3] staging/gdm72xx: Include corresponding header file (fix sparse warning) Peter Huewe
@ 2013-02-19 17:50 ` Peter Huewe
  2013-02-19 17:50 ` [PATCH 3/3] staging/gdm72xx: Remove duplicated code " Peter Huewe
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Huewe @ 2013-02-19 17:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: David S. Miller, Pablo Neira Ayuso, Stephen Hemminger,
	Eric W. Biederman, Sage Ahn, Macpaul Lin, YAMANE Toshiaki,
	Devendra Naga, devel, linux-kernel, Peter Huewe

len is never read after assignment, thus can be removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/gdm72xx/gdm_qos.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c
index 1e63031..d48994b 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -337,7 +337,6 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 	struct nic *nic = nic_ptr;
 	u32 i, SFID, index, pos;
 	u8 subCmdEvt;
-	u8 len;
 	struct qos_cb_s *qcb = &nic->qos;
 	struct qos_entry_s *entry, *n;
 	struct list_head send_list;
@@ -347,8 +346,6 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 	subCmdEvt = (u8)buf[4];
 
 	if (subCmdEvt == QOS_REPORT) {
-		len = (u8)buf[5];
-
 		spin_lock_irqsave(&qcb->qos_lock, flags);
 		for (i = 0; i < qcb->qos_list_cnt; i++) {
 			SFID = ((buf[(i*5)+6]<<24)&0xff000000);
@@ -369,8 +366,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 		send_qos_list(nic, &send_list);
 		return;
 	} else if (subCmdEvt == QOS_ADD) {
-		pos = 5;
-		len = (u8)buf[pos++];
+		pos = 6;
 
 		SFID = ((buf[pos++]<<24)&0xff000000);
 		SFID += ((buf[pos++]<<16)&0xff0000);
@@ -424,8 +420,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 		qcb->qos_limit_size = 254/qcb->qos_list_cnt;
 		spin_unlock_irqrestore(&qcb->qos_lock, flags);
 	} else if (subCmdEvt == QOS_CHANGE_DEL) {
-		pos = 5;
-		len = (u8)buf[pos++];
+		pos = 6;
 		SFID = ((buf[pos++]<<24)&0xff000000);
 		SFID += ((buf[pos++]<<16)&0xff0000);
 		SFID += ((buf[pos++]<<8)&0xff00);
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] staging/gdm72xx: Remove duplicated code in gdm_qos.c
  2013-02-19 17:50 [PATCH 1/3] staging/gdm72xx: Include corresponding header file (fix sparse warning) Peter Huewe
  2013-02-19 17:50 ` [PATCH 2/3] staging/gdm72xx: Remove unused variable in gdm_qos.c Peter Huewe
@ 2013-02-19 17:50 ` Peter Huewe
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Huewe @ 2013-02-19 17:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: David S. Miller, Pablo Neira Ayuso, Stephen Hemminger,
	Eric W. Biederman, Sage Ahn, Macpaul Lin, YAMANE Toshiaki,
	Devendra Naga, devel, linux-kernel, Peter Huewe

The first branch of the if statement is ended with a return thus there
is no need for an else if, and thus we can move the duplicated code to
the top and use it for the other two branches.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/gdm72xx/gdm_qos.c |   42 +++++++++++++++----------------------
 1 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c
index d48994b..b795353 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -365,20 +365,24 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 		spin_unlock_irqrestore(&qcb->qos_lock, flags);
 		send_qos_list(nic, &send_list);
 		return;
-	} else if (subCmdEvt == QOS_ADD) {
-		pos = 6;
-
-		SFID = ((buf[pos++]<<24)&0xff000000);
-		SFID += ((buf[pos++]<<16)&0xff0000);
-		SFID += ((buf[pos++]<<8)&0xff00);
-		SFID += (buf[pos++]);
-
-		index = get_csr(qcb, SFID, 1);
-		if (index == -1) {
-			netdev_err(nic->netdev, "QoS ERROR: csr Update Error\n");
-			return;
-		}
+	}
 
+	/* subCmdEvt == QOS_ADD || subCmdEvt == QOS_CHANG_DEL */
+	pos = 6;
+	SFID = ((buf[pos++]<<24)&0xff000000);
+	SFID += ((buf[pos++]<<16)&0xff0000);
+	SFID += ((buf[pos++]<<8)&0xff00);
+	SFID += (buf[pos++]);
+
+	index = get_csr(qcb, SFID, 1);
+	if (index == -1) {
+		netdev_err(nic->netdev,
+			   "QoS ERROR: csr Update Error / Wrong index (%d) \n",
+			   index);
+		return;
+	}
+
+	if (subCmdEvt == QOS_ADD) {
 		netdev_dbg(nic->netdev, "QOS_ADD SFID = 0x%x, index=%d\n",
 			   SFID, index);
 
@@ -420,18 +424,6 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)
 		qcb->qos_limit_size = 254/qcb->qos_list_cnt;
 		spin_unlock_irqrestore(&qcb->qos_lock, flags);
 	} else if (subCmdEvt == QOS_CHANGE_DEL) {
-		pos = 6;
-		SFID = ((buf[pos++]<<24)&0xff000000);
-		SFID += ((buf[pos++]<<16)&0xff0000);
-		SFID += ((buf[pos++]<<8)&0xff00);
-		SFID += (buf[pos++]);
-		index = get_csr(qcb, SFID, 1);
-		if (index == -1) {
-			netdev_err(nic->netdev, "QoS ERROR: Wrong index(%d)\n",
-				   index);
-			return;
-		}
-
 		netdev_dbg(nic->netdev, "QOS_CHANGE_DEL SFID = 0x%x, index=%d\n",
 			   SFID, index);
 
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-19 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 17:50 [PATCH 1/3] staging/gdm72xx: Include corresponding header file (fix sparse warning) Peter Huewe
2013-02-19 17:50 ` [PATCH 2/3] staging/gdm72xx: Remove unused variable in gdm_qos.c Peter Huewe
2013-02-19 17:50 ` [PATCH 3/3] staging/gdm72xx: Remove duplicated code " Peter Huewe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.