From: Daniel Mack Date: Sun, 26 Oct 2014 16:30:22 +0000 (+0100) Subject: connection, handle: fix a number of checkpatch warnings X-Git-Tag: upstream/0.20141102.012929utc~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2171f04b0e5153ef486f2bb02dd0dffbbcd53b82;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git connection, handle: fix a number of checkpatch warnings Signed-off-by: Daniel Mack --- diff --git a/connection.c b/connection.c index 771fdaf..4bafc63 100644 --- a/connection.c +++ b/connection.c @@ -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; diff --git a/handle.c b/handle.c index 9725949..1481057 100644 --- 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; } diff --git a/message.c b/message.c index 579ad76..8f40314 100644 --- 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;