diff options
author | Daniel Mack <zonque@gmail.com> | 2014-01-22 21:16:19 +0100 |
---|---|---|
committer | Daniel Mack <zonque@gmail.com> | 2014-01-22 21:16:19 +0100 |
commit | 20d03561036b28ce9b4ae4f817f9756f26854013 (patch) | |
tree | 27d74c4c54d8431117777bf0240ef383b5647920 | |
parent | d956ad4f26f5f4fc8160e298ea616d135a630509 (diff) | |
download | kdbus-bus-20d03561036b28ce9b4ae4f817f9756f26854013.tar.gz kdbus-bus-20d03561036b28ce9b4ae4f817f9756f26854013.tar.bz2 kdbus-bus-20d03561036b28ce9b4ae4f817f9756f26854013.zip |
more trivial style issues
In particular, checkpatch.pl --strict says stuff like this:
CHECK: Prefer kzalloc(sizeof(*slice)...) over kzalloc(sizeof(struct kdbus_slice)...)
+ slice = kzalloc(sizeof(struct kdbus_slice), GFP_KERNEL);
-rw-r--r-- | bus.c | 2 | ||||
-rw-r--r-- | connection.c | 4 | ||||
-rw-r--r-- | endpoint.c | 4 | ||||
-rw-r--r-- | handle.c | 6 | ||||
-rw-r--r-- | memfd.c | 2 | ||||
-rw-r--r-- | metadata.c | 9 | ||||
-rw-r--r-- | names.c | 3 | ||||
-rw-r--r-- | namespace.c | 4 | ||||
-rw-r--r-- | pool.c | 4 |
9 files changed, 19 insertions, 19 deletions
@@ -203,7 +203,7 @@ int kdbus_bus_new(struct kdbus_ns *ns, return -EEXIST; } - b = kzalloc(sizeof(struct kdbus_bus), GFP_KERNEL); + b = kzalloc(sizeof(*b), GFP_KERNEL); if (!b) return -ENOMEM; diff --git a/connection.c b/connection.c index f1e4201156f..51d22fee8bc 100644 --- a/connection.c +++ b/connection.c @@ -460,7 +460,7 @@ static int kdbus_conn_queue_insert(struct kdbus_conn *conn, if (kmsg->fds && !(conn->flags & KDBUS_HELLO_ACCEPT_FD)) return -ECOMM; - queue = kzalloc(sizeof(struct kdbus_conn_queue), GFP_KERNEL); + queue = kzalloc(sizeof(*queue), GFP_KERNEL); if (!queue) return -ENOMEM; @@ -699,7 +699,7 @@ static void kdbus_conn_timeout_schedule_scan(struct kdbus_conn *conn) static void kdbus_conn_timer_func(unsigned long val) { - struct kdbus_conn *conn = (struct kdbus_conn *) val; + struct kdbus_conn *conn = (struct kdbus_conn *)val; kdbus_conn_timeout_schedule_scan(conn); } diff --git a/endpoint.c b/endpoint.c index 4b3bf5bd1a1..26b64d41d96 100644 --- a/endpoint.c +++ b/endpoint.c @@ -161,7 +161,7 @@ int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_ns *ns, const char *name, return -EEXIST; } - e = kzalloc(sizeof(struct kdbus_ep), GFP_KERNEL); + e = kzalloc(sizeof(*e), GFP_KERNEL); if (!e) return -ENOMEM; @@ -191,7 +191,7 @@ int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_ns *ns, const char *name, mutex_unlock(&ns->lock); /* register bus endpoint device */ - e->dev = kzalloc(sizeof(struct device), GFP_KERNEL); + e->dev = kzalloc(sizeof(*e->dev), GFP_KERNEL); if (!e->dev) { ret = -ENOMEM; goto exit; @@ -96,7 +96,7 @@ static int kdbus_handle_open(struct inode *inode, struct file *file) struct kdbus_ep *ep; int ret; - handle = kzalloc(sizeof(struct kdbus_handle), GFP_KERNEL); + handle = kzalloc(sizeof(*handle), GFP_KERNEL); if (!handle) return -ENOMEM; @@ -242,7 +242,7 @@ static int kdbus_handle_memfd(void __user *buf) int __user *addr; int fd, ret; - ret = kdbus_memdup_user(buf, (void **) &m, NULL, + ret = kdbus_memdup_user(buf, (void **)&m, NULL, sizeof(struct kdbus_cmd_memfd_make), sizeof(struct kdbus_cmd_memfd_make) + KDBUS_MAKE_MAX_SIZE); @@ -681,7 +681,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, /* store the offset of the reply back to userspace */ if (kmsg->msg.flags & KDBUS_MSG_FLAGS_SYNC_REPLY) { - u8 *off = (u8 *) buf + + u8 *off = (u8 *)buf + offsetof(struct kdbus_msg, offset_reply); if (copy_to_user(off, &kmsg->msg.offset_reply, @@ -110,7 +110,7 @@ int kdbus_memfd_new(const char *name, size_t size, int *fd) int f; int ret; - mf = kzalloc(sizeof(struct kdbus_memfile), GFP_KERNEL); + mf = kzalloc(sizeof(*mf), GFP_KERNEL); if (!mf) return -ENOMEM; diff --git a/metadata.c b/metadata.c index 24c80342bde..7002245acc0 100644 --- a/metadata.c +++ b/metadata.c @@ -41,7 +41,7 @@ int kdbus_meta_new(struct kdbus_meta **meta) BUG_ON(*meta); - m = kzalloc(sizeof(struct kdbus_meta), GFP_KERNEL); + m = kzalloc(sizeof(*m), GFP_KERNEL); if (!m) return -ENOMEM; @@ -103,7 +103,6 @@ kdbus_meta_append_item(struct kdbus_meta *meta, size_t extra_size) kfree(meta->data); meta->data = data; meta->allocated_size = size; - } /* insert new record */ @@ -244,7 +243,7 @@ static int kdbus_meta_append_exe(struct kdbus_meta *meta) char *tmp; char *pathname; - tmp = (char *) __get_free_page(GFP_TEMPORARY | __GFP_ZERO); + tmp = (char *)__get_free_page(GFP_TEMPORARY | __GFP_ZERO); if (!tmp) { path_put(exe_path); return -ENOMEM; @@ -270,7 +269,7 @@ static int kdbus_meta_append_cmdline(struct kdbus_meta *meta) char *tmp; int ret = 0; - tmp = (char *) __get_free_page(GFP_TEMPORARY | __GFP_ZERO); + tmp = (char *)__get_free_page(GFP_TEMPORARY | __GFP_ZERO); if (!tmp) return -ENOMEM; @@ -324,7 +323,7 @@ static int kdbus_meta_append_cgroup(struct kdbus_meta *meta) char *tmp; int ret; - tmp = (char *) __get_free_page(GFP_TEMPORARY | __GFP_ZERO); + tmp = (char *)__get_free_page(GFP_TEMPORARY | __GFP_ZERO); if (!tmp) return -ENOMEM; @@ -347,7 +347,8 @@ bool kdbus_name_is_valid(const char *p) if (dot) return false; - found_dot = dot = true; + found_dot = true; + dot = true; } else { bool good; diff --git a/namespace.c b/namespace.c index 547e8a59a1c..99b66ccbbf8 100644 --- a/namespace.c +++ b/namespace.c @@ -206,7 +206,7 @@ int kdbus_ns_new(struct kdbus_ns *parent, const char *name, umode_t mode, if ((parent && !name) || (!parent && name)) return -EINVAL; - n = kzalloc(sizeof(struct kdbus_ns), GFP_KERNEL); + n = kzalloc(sizeof(*n), GFP_KERNEL); if (!n) return -ENOMEM; @@ -274,7 +274,7 @@ int kdbus_ns_new(struct kdbus_ns *parent, const char *name, umode_t mode, n->id = ++kdbus_ns_seq_last; /* register control device for this namespace */ - n->dev = kzalloc(sizeof(struct device), GFP_KERNEL); + n->dev = kzalloc(sizeof(*n->dev), GFP_KERNEL); if (!n->dev) { ret = -ENOMEM; goto exit_unlock; @@ -92,7 +92,7 @@ static struct kdbus_slice *kdbus_pool_slice_new(size_t off, size_t size) { struct kdbus_slice *slice; - slice = kzalloc(sizeof(struct kdbus_slice), GFP_KERNEL); + slice = kzalloc(sizeof(*slice), GFP_KERNEL); if (!slice) return NULL; @@ -285,7 +285,7 @@ int kdbus_pool_new(const char *name, size_t size, struct kdbus_pool **pool) BUG_ON(*pool); - p = kzalloc(sizeof(struct kdbus_pool), GFP_KERNEL); + p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) return -ENOMEM; |