All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH btbridge 0/7] Warning fixes
@ 2015-11-23  9:50 OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 1/7] Sort headers OpenBMC Patches
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

These were found when building with `-Wall`. The makefile will now build with warnings enabled.

https://github.com/openbmc/btbridge/pull/6

Joel Stanley (7):
  Sort headers
  Add missing include for ioctl
  Remove unused variables
  Fix printf format warnings
  method_send_sms_atn: Log the ioctl number
  bt_host_write: fix invalid check
  Makefile: fix linking and enable -Wall

 Makefile    |  4 ++--
 btbridged.c | 49 +++++++++++++++++++++++--------------------------
 2 files changed, 25 insertions(+), 28 deletions(-)

-- 
2.6.3

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

* [PATCH btbridge 1/7] Sort headers
  2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
@ 2015-11-23  9:50 ` OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 2/7] Add missing include for ioctl OpenBMC Patches
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 btbridged.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/btbridged.c b/btbridged.c
index d1de79f..7a094a4 100644
--- a/btbridged.c
+++ b/btbridged.c
@@ -13,22 +13,22 @@
  *	limitations under the License.
  */
 
+#include <assert.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <limits.h>
+#include <poll.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
+#include <syslog.h>
 #include <sys/mman.h>
+#include <sys/stat.h>
 #include <sys/timerfd.h>
-#include <syslog.h>
-#include <poll.h>
-#include <limits.h>
-#include <getopt.h>
 #include <time.h>
-#include <assert.h>
+#include <unistd.h>
 
 #include <linux/bt-host.h>
 
-- 
2.6.3

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

* [PATCH btbridge 2/7] Add missing include for ioctl
  2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 1/7] Sort headers OpenBMC Patches
@ 2015-11-23  9:50 ` OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 3/7] Remove unused variables OpenBMC Patches
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 btbridged.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/btbridged.c b/btbridged.c
index 7a094a4..550125c 100644
--- a/btbridged.c
+++ b/btbridged.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <syslog.h>
 #include <sys/mman.h>
+#include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/timerfd.h>
 #include <time.h>
-- 
2.6.3

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

* [PATCH btbridge 3/7] Remove unused variables
  2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 1/7] Sort headers OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 2/7] Add missing include for ioctl OpenBMC Patches
@ 2015-11-23  9:50 ` OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 4/7] Fix printf format warnings OpenBMC Patches
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 btbridged.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/btbridged.c b/btbridged.c
index 550125c..bee4974 100644
--- a/btbridged.c
+++ b/btbridged.c
@@ -260,10 +260,9 @@ static int method_send_message(sd_bus_message *msg, void *userdata, sd_bus_error
 {
 	struct btbridged_context *context;
 	struct bt_queue *bt_msg;
-	uint8_t *data, *all_data;
-	size_t data_sz, all_data_sz;
+	uint8_t *data;
+	size_t data_sz;
 	uint8_t netfn, lun, seq, cmd, cc;
-	uint64_t cookie;
 	/*
 	 * Doesn't say it anywhere explicitly but it looks like returning 0 or
 	 * negative is BAD...
@@ -477,7 +476,6 @@ static int dispatch_bt(struct btbridged_context *context)
 
 	if (context->fds[BT_FD].revents & POLLIN) {
 		sd_bus_message *msg;
-		int data_len;
 		struct bt_queue *new;
 		uint8_t data[BT_MAX_MESSAGE] = { 0 };
 
@@ -599,11 +597,8 @@ static const sd_bus_vtable ipmid_vtable[] = {
 
 int main(int argc, char *argv[]) {
 	struct btbridged_context context;
-	struct bt_queue *bt_q;
-	const char *path;
 	const char *name = argv[0];
-	int opt, polled, r, daemonise;
-	uint8_t buf[BT_MAX_MESSAGE];
+	int opt, polled, r;
 
 	static struct option long_options[] = {
 		{ "verbose", no_argument, &verbose, 1 },
-- 
2.6.3

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

* [PATCH btbridge 4/7] Fix printf format warnings
  2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
                   ` (2 preceding siblings ...)
  2015-11-23  9:50 ` [PATCH btbridge 3/7] Remove unused variables OpenBMC Patches
@ 2015-11-23  9:50 ` OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 5/7] method_send_sms_atn: Log the ioctl number OpenBMC Patches
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 btbridged.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/btbridged.c b/btbridged.c
index bee4974..a8c84aa 100644
--- a/btbridged.c
+++ b/btbridged.c
@@ -351,7 +351,7 @@ static int bt_host_write(struct btbridged_context *context, struct bt_queue *bt_
 	data[3] = bt_msg->rsp.cmd;
 	data[4] = bt_msg->rsp.cc;
 	if (bt_msg->rsp.data_len > sizeof(data) - 5) {
-		MSG_ERR("Response message size (%d) too big, truncating\n", bt_msg->rsp.data_len);
+		MSG_ERR("Response message size (%zu) too big, truncating\n", bt_msg->rsp.data_len);
 		bt_msg->rsp.data_len = sizeof(data) - 5;
 	}
 	/* netfn/len + seq + cmd + cc = 4 */
@@ -524,7 +524,7 @@ static int dispatch_bt(struct btbridged_context *context)
 
 		r = sd_bus_message_append_array(msg, 'y', data + 4, new->req.data_len);
 		if (r < 0) {
-			MSG_ERR("Couldn't append array to signal\n", strerror(-r));
+			MSG_ERR("Couldn't append array to signal: %s\n", strerror(-r));
 			goto out1_free;
 		}
 
@@ -564,15 +564,15 @@ out1:
 		bt_msg = bt_q_get_msg(context);
 		if (!bt_msg) {
 			/* Odd, this shouldn't really happen */
-			MSG_ERR("Got a POLLOUT on %s but no message is ready to be written\n");
+			MSG_ERR("Got a POLLOUT but no message is ready to be written\n");
 			r = 0;
 			goto out;
 		}
 		r = bt_host_write(context, bt_msg);
 		if (r < 0)
 			MSG_ERR("Problem putting request with seq 0x%02x, netfn 0x%02x, lun 0x%02x, cmd 0x%02x, cc 0x%02x\n"
-					"out to %s", BT_HOST_PATH, bt_msg->rsp.seq, bt_msg->rsp.netfn, bt_msg->rsp.lun,
-					bt_msg->rsp.cmd, bt_msg->rsp.cc);
+					"out to %s", bt_msg->rsp.seq, bt_msg->rsp.netfn, bt_msg->rsp.lun,
+					bt_msg->rsp.cmd, bt_msg->rsp.cc, BT_HOST_PATH);
 		else
 			MSG_OUT("Completed request with seq 0x%02x, netfn 0x%02x, lun 0x%02x, cmd 0x%02x, cc 0x%02x\n",
 					bt_msg->rsp.seq, bt_msg->rsp.netfn, bt_msg->rsp.lun, bt_msg->rsp.cmd, bt_msg->rsp.cc);
-- 
2.6.3

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

* [PATCH btbridge 5/7] method_send_sms_atn: Log the ioctl number
  2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
                   ` (3 preceding siblings ...)
  2015-11-23  9:50 ` [PATCH btbridge 4/7] Fix printf format warnings OpenBMC Patches
@ 2015-11-23  9:50 ` OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 6/7] bt_host_write: fix invalid check OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 7/7] Makefile: fix linking and enable -Wall OpenBMC Patches
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

This may help with debugging issues with old kernel headers.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 btbridged.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/btbridged.c b/btbridged.c
index a8c84aa..9dbed09 100644
--- a/btbridged.c
+++ b/btbridged.c
@@ -237,13 +237,14 @@ static struct bt_queue *bt_q_dequeue(struct btbridged_context *context)
 	return r;
 }
 
-static int method_send_sms_atn(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error)
+static int method_send_sms_atn(sd_bus_message *msg, void *userdata,
+			       sd_bus_error *ret_error)
 {
 	int r;
-	struct btbridged_context *bt_fd = (struct btbridged_context *)userdata;
-
-	MSG_OUT("Sending SMS_ATN ioctl() to %s\n", BT_HOST_PATH);
+	struct btbridged_context *bt_fd = userdata;
 
+	MSG_OUT("Sending SMS_ATN ioctl (%d) to %s\n",
+			BT_HOST_IOCTL_SMS_ATN, BT_HOST_PATH);
 
 	r = ioctl(bt_fd->fds[BT_FD].fd, BT_HOST_IOCTL_SMS_ATN);
 	if (r == -1) {
-- 
2.6.3

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

* [PATCH btbridge 6/7] bt_host_write: fix invalid check
  2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
                   ` (4 preceding siblings ...)
  2015-11-23  9:50 ` [PATCH btbridge 5/7] method_send_sms_atn: Log the ioctl number OpenBMC Patches
@ 2015-11-23  9:50 ` OpenBMC Patches
  2015-11-23  9:50 ` [PATCH btbridge 7/7] Makefile: fix linking and enable -Wall OpenBMC Patches
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

r is uninitalised, so this check is undefined. Change it to check len
instead.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 btbridged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/btbridged.c b/btbridged.c
index 9dbed09..c57843d 100644
--- a/btbridged.c
+++ b/btbridged.c
@@ -361,7 +361,7 @@ static int bt_host_write(struct btbridged_context *context, struct bt_queue *bt_
 		memcpy(data + 5, bt_msg->rsp.data, bt_msg->rsp.data_len);
 	/* Count the data[0] byte */
 	len = write(context->fds[BT_FD].fd, data, data[0] + 1);
-	if (r == -1) {
+	if (len == -1) {
 		r = errno;
 		MSG_ERR("Error writing to %s: %s\n", BT_HOST_PATH, strerror(errno));
 		if (bt_msg->call) {
-- 
2.6.3

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

* [PATCH btbridge 7/7] Makefile: fix linking and enable -Wall
  2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
                   ` (5 preceding siblings ...)
  2015-11-23  9:50 ` [PATCH btbridge 6/7] bt_host_write: fix invalid check OpenBMC Patches
@ 2015-11-23  9:50 ` OpenBMC Patches
  6 siblings, 0 replies; 8+ messages in thread
From: OpenBMC Patches @ 2015-11-23  9:50 UTC (permalink / raw)
  To: openbmc

From: Joel Stanley <joel@jms.id.au>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index a55897f..9d1f5b9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-CPPFLAGS=$(shell pkg-config --cflags libsystemd)
-LDFLAGS=$(shell pkg-config --libs libsystemd)
+CFLAGS	= $(shell pkg-config --cflags libsystemd) -Wall -O2
+LDLIBS	= $(shell pkg-config --libs libsystemd)
 
 EXE = btbridged
 
-- 
2.6.3

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

end of thread, other threads:[~2015-11-23  9:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23  9:50 [PATCH btbridge 0/7] Warning fixes OpenBMC Patches
2015-11-23  9:50 ` [PATCH btbridge 1/7] Sort headers OpenBMC Patches
2015-11-23  9:50 ` [PATCH btbridge 2/7] Add missing include for ioctl OpenBMC Patches
2015-11-23  9:50 ` [PATCH btbridge 3/7] Remove unused variables OpenBMC Patches
2015-11-23  9:50 ` [PATCH btbridge 4/7] Fix printf format warnings OpenBMC Patches
2015-11-23  9:50 ` [PATCH btbridge 5/7] method_send_sms_atn: Log the ioctl number OpenBMC Patches
2015-11-23  9:50 ` [PATCH btbridge 6/7] bt_host_write: fix invalid check OpenBMC Patches
2015-11-23  9:50 ` [PATCH btbridge 7/7] Makefile: fix linking and enable -Wall OpenBMC Patches

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.