connection, handle: fix a number of checkpatch warnings
authorDaniel Mack <daniel@zonque.org>
Sun, 26 Oct 2014 16:30:22 +0000 (17:30 +0100)
committerDaniel Mack <daniel@zonque.org>
Sun, 26 Oct 2014 16:30:22 +0000 (17:30 +0100)
Signed-off-by: Daniel Mack <daniel@zonque.org>
connection.c
handle.c
message.c

index 771fdafb7f9e3141217465806e352ed19a331f8a..4bafc6332fdac75b0bdcffb7594e0a65aaf07648 100644 (file)
@@ -1377,8 +1377,10 @@ int kdbus_cmd_conn_update(struct kdbus_conn *conn,
        KDBUS_ITEMS_FOREACH(item, cmd->items, KDBUS_ITEMS_SIZE(cmd, items)) {
                switch (item->type) {
                case KDBUS_ITEM_ATTACH_FLAGS:
-                       /* Only ordinary or monitor connections
-                        * may update their attach-flags */
+                       /*
+                        * Only ordinary or monitor connections
+                        * may update their attach-flags.
+                        */
                        if (!kdbus_conn_is_connected(conn) &&
                            !kdbus_conn_is_monitor(conn))
                                return -EOPNOTSUPP;
@@ -1389,8 +1391,9 @@ int kdbus_cmd_conn_update(struct kdbus_conn *conn,
 
                case KDBUS_ITEM_NAME:
                case KDBUS_ITEM_POLICY_ACCESS:
-                       /* Only policy holders may update their policy
-                        * entries */
+                       /*
+                        * Only policy holders may update their policy entries.
+                        */
                        if (!kdbus_conn_is_policy_holder(conn))
                                return -EOPNOTSUPP;
 
index 97259494910304b65f748b5833c5fb9bf308eae4..14810577e269197198527ee4a59ab9342e995364 100644 (file)
--- a/handle.c
+++ b/handle.c
@@ -128,14 +128,14 @@ static void *kdbus_minor_pack(enum kdbus_minor_type type, void *ptr)
        if (WARN_ON(p & 0x3UL || type >= KDBUS_MINOR_CNT))
                return NULL;
 
-       return (void*)(p | (unsigned long)type);
+       return (void *)(p | (unsigned long)type);
 }
 
 static enum kdbus_minor_type kdbus_minor_unpack(void **ptr)
 {
        unsigned long p = (unsigned long)*ptr;
 
-       *ptr = (void*)(p & ~0x3UL);
+       *ptr = (void *)(p & ~0x3UL);
        return p & 0x3UL;
 }
 
index 579ad7609075716f0aadf408ffaef87141560242..8f40314f9edddbcabd1540af2f6c8735201eb3ed 100644 (file)
--- a/message.c
+++ b/message.c
@@ -171,11 +171,12 @@ static int kdbus_msg_scan_items(struct kdbus_conn *conn,
                        int seals, mask;
                        int fd = item->memfd.fd;
 
-                       /*
-                        * Verify the fd and increment the usage
-                        * count
-                        */
-                       if (fd < 0 || !(f = fget(fd)))
+                       /* Verify the fd and increment the usage count */
+                       if (fd < 0)
+                               return -EBADF;
+
+                       f = fget(fd);
+                       if (!f)
                                return -EBADF;
 
                        kmsg->memfds[kmsg->memfds_count] = f;
@@ -231,11 +232,14 @@ static int kdbus_msg_scan_items(struct kdbus_conn *conn,
                                int fd = item->fds[i];
 
                                /*
-                                * Verify the fd and increment the
-                                * usage count. Use fget_raw() to allow
-                                * passing O_PATH fds
+                                * Verify the fd and increment the usage count.
+                                * Use fget_raw() to allow passing O_PATH fds.
                                 */
-                               if (fd < 0 || !(f = fget_raw(fd)))
+                               if (fd < 0)
+                                       return -EBADF;
+
+                               f = fget_raw(fd);
+                               if (!f)
                                        return -EBADF;
 
                                kmsg->fds[i] = f;