[rtems commit] cpukit/dev/can: Resolve warnings in 64bit builds

Joel Sherrill joel at rtems.org
Mon Jan 30 16:28:55 UTC 2023


Module:    rtems
Branch:    master
Commit:    4c0a2d47e1dce0923f270d0206d0cb93d0d58451
Changeset: http://git.rtems.org/rtems/commit/?id=4c0a2d47e1dce0923f270d0206d0cb93d0d58451

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Thu Jan 26 12:18:44 2023 -0600

cpukit/dev/can: Resolve warnings in 64bit builds

This resolves various gcc warnings in AArch64 LP64 builds of the CAN
framework.

---

 cpukit/dev/can/can.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/cpukit/dev/can/can.c b/cpukit/dev/can/can.c
index 2e6d5df65b..9f3fe0db98 100644
--- a/cpukit/dev/can/can.c
+++ b/cpukit/dev/can/can.c
@@ -34,6 +34,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <inttypes.h>
 #include <string.h>
 #include <stdlib.h>
 
@@ -57,13 +58,13 @@
                            real_can_interrupt_lock_release(bus);  \
                          } while (0);
 
-static ssize_t 
+static int
 can_bus_open(rtems_libio_t *iop, const char *path, int oflag, mode_t mode);
 static ssize_t 
 can_bus_read(rtems_libio_t *iop, void *buffer, size_t count);
 static ssize_t 
 can_bus_write(rtems_libio_t *iop, const void *buffer, size_t count);
-static ssize_t 
+static int
 can_bus_ioctl(rtems_libio_t *iop, ioctl_command_t request, void *buffer);
 
 static int can_xmit(struct can_bus *bus);
@@ -179,7 +180,7 @@ static int try_sem(struct can_bus *bus)
   return ret;
 }
 
-static ssize_t 
+static int
 can_bus_open(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
 {
   CAN_DEBUG("can_bus_open\n");
@@ -210,7 +211,8 @@ static ssize_t can_bus_read(rtems_libio_t *iop, void *buffer, size_t count)
   len = CAN_MSG_LEN(&bus->can_rx_msg);
 
   if (count < len) {
-    CAN_DEBUG("can_bus_read: buffer size is small min sizeof(struct can_msg) = %u\n",
+    CAN_DEBUG("can_bus_read: buffer size is small min "
+              "sizeof(struct can_msg) = %" PRIuPTR "\n",
                     sizeof(struct can_msg));
     return -RTEMS_INVALID_SIZE;
   }
@@ -314,8 +316,8 @@ can_bus_write(rtems_libio_t *iop, const void *buffer, size_t count)
 
   CAN_DEBUG_TX("can_bus_write: can_msg_size = %u\n", msg_size);
   if (msg_size > sizeof(struct can_msg)) {
-    CAN_ERR("can_bus_write:"
-          "can message len error msg_size = %u struct can_msg = %u\n", 
+    CAN_ERR("can_bus_write: can message "
+            "len error msg_size = %u struct can_msg = %" PRIxPTR "\n",
           msg_size, sizeof(struct can_msg));
     return -RTEMS_INVALID_SIZE;
   }
@@ -363,7 +365,7 @@ release_lock_and_return:
   return ret;
 }
 
-static ssize_t 
+static int
 can_bus_ioctl(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
 {
   can_bus *bus = IMFS_generic_get_context_by_iop(iop);



More information about the vc mailing list