[PATCH BlueZ] btmgmt: fix used without initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes the following warning being treated as error:
mgmt/main.c: In function 'mgmt_process_data':
mgmt/main.c:508:3: error: 'len' may be used uninitialized in this
function [-Werror=uninitialized]
---
 mgmt/main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mgmt/main.c b/mgmt/main.c
index c970f62..d939cca 100644
--- a/mgmt/main.c
+++ b/mgmt/main.c
@@ -504,8 +504,10 @@ static int mgmt_process_data(int mgmt_sk)
 
 	ret = read(mgmt_sk, buf, sizeof(buf));
 	if (ret < 0) {
-		fprintf(stderr, "read: %s\n", strerror(errno));
-		return len;
+		int err = errno;
+
+		fprintf(stderr, "read: %s\n", strerror(err));
+		return -err;
 	}
 
 	if (ret < MGMT_HDR_SIZE) {
-- 
1.7.7.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux