Skip to contentSkip to conversation

Fix unused variable warning in rfcomm

PATCH In review Daniele Venzano 3 participants 4 messages Jan 23, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix unused variable warning in rfcomm

The following patch fixes a warning generated when compiling rfcomm.c without CONFIG_BT_RFCOMM_DEBUG.
The warning was:
net/bluetooth/rfcomm/sock.c: In function ‘rfcomm_sock_ioctl’:
net/bluetooth/rfcomm/sock.c:795: warning: unused variable ‘sk’

Patch is against 2.6.28.1

net/bluetooth/rfcomm/sock.c +2 -0
@@ -792,7 +792,9 @@ static int rfcomm_sock_getsockopt(struct
 
 static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
+#ifdef CONFIG_BT_RFCOMM_DEBUG
 	struct sock *sk = sock->sk;
+#endif
 	int err;
 
 	BT_DBG("sk %p cmd %x arg %lx", sk, cmd, arg);
#1 lore raw

2009/1/23 Daniele Venzano <[email protected]>:

Quoted 14 lines

The following patch fixes a warning generated when compiling rfcomm.c without CONFIG_BT_RFCOMM_DEBUG.
The warning was:
net/bluetooth/rfcomm/sock.c: In function 'rfcomm_sock_ioctl':
net/bluetooth/rfcomm/sock.c:795: warning: unused variable 'sk'

Patch is against 2.6.28.1

net/bluetooth/rfcomm/sock.c 2009-01-23 10:31:25.000000000 +0100 static int rfcomm_sock_getsockopt(struct · line 800

Quoted 9 lines
net/bluetooth/rfcomm/sock.c 2009-01-23 10:31:25.000000000 +0100 renamed from net/bluetooth/rfcomm/sock.c 2009-01-23 10:30:34.000000000 +0100 +2 -0
@@ -792,7 +792,9 @@ static int rfcomm_sock_getsockopt(struct
 
 static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
+#ifdef CONFIG_BT_RFCOMM_DEBUG
       struct sock *sk = sock->sk;
+#endif
       int err;
 
       BT_DBG("sk %p cmd %x arg %lx", sk, cmd, arg);

if CONFIG_BT_RFCOMM_TTY is set, the compilation will break.

richard.

#2 lore raw
In reply to Daniele Venzano

Sorry, shouldn't have missed that.

The following patch fixes a warning generated when compiling rfcomm.c without CONFIG_BT_RFCOMM_DEBUG.
The warning was:
net/bluetooth/rfcomm/sock.c: In function 'rfcomm_sock_ioctl':
net/bluetooth/rfcomm/sock.c:795: warning: unused variable 'sk'

Patch is against 2.6.28.1

net/bluetooth/rfcomm/sock.c +2 -0
@@ -792,7 +792,9 @@ static int rfcomm_sock_getsockopt(struct
 
 static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
+#if defined(CONFIG_BT_RFCOMM_DEBUG) || defined(CONFIG_BT_RFCOMM_TTY)
 	struct sock *sk = sock->sk;
+#endif
 	int err;
 
 	BT_DBG("sk %p cmd %x arg %lx", sk, cmd, arg);
maintainer
#3 lore raw

Hi guys,

Quoted 7 lines

Sorry, shouldn't have missed that.

The following patch fixes a warning generated when compiling rfcomm.c without CONFIG_BT_RFCOMM_DEBUG.
The warning was:
net/bluetooth/rfcomm/sock.c: In function 'rfcomm_sock_ioctl':
net/bluetooth/rfcomm/sock.c:795: warning: unused variable 'sk'

this has been fixed upstream already. So why does this come up again?

Regards

Marcel