Re: [PATCH 01/12] VMCI: context implementation.
From: Joe Perches <joe@perches.com>
Date: 2012-11-21 21:04:48
Also in:
lkml
On Wed, 2012-11-21 at 12:31 -0800, George Zhang wrote:
VMCI Context code maintains state for vmci and allows the driver to communicate with multiple VMs
Just some trivial notes.
quoted hunk ↗ jump to hunk
diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
[] It'd be nicer if you added this #define before any #include #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt so that pr_<level> messages are prefixed. (never mind, found a similar macro in patch 12/12)
+#include <linux/vmw_vmci_defs.h> +#include <linux/vmw_vmci_api.h>
[]
+ context = kzalloc(sizeof(*context), GFP_KERNEL);
+ if (!context) {
+ pr_warn("Failed to allocate memory for VMCI context.\n");OOM logging messages aren't necessary as alloc failures are already logged with a stack trace. That goes for the entire patch series.
+ /* Fire event to all subscribers. */
+ array_size = vmci_handle_arr_get_size(subscriber_array);
+ for (i = 0; i < array_size; i++) {
+ int result;
+ struct vmci_event_msg *e_msg;
+ struct vmci_event_payld_ctx *ev_payload;
+ char buf[sizeof(*e_msg) + sizeof(*ev_payload)];Maybe just use struct vmci_event_msg e_msg; struct vmci_event_payld_ctx ev_payload; and change the addressing or use a cast as appropriate?
+ /* Allocate guest call entry and add it to the target VM's queue. */
+ dq_entry = kmalloc(sizeof(*dq_entry), GFP_KERNEL);
+ if (dq_entry == NULL) {
+ pr_warn("Failed to allocate memory for datagram.\n");Another unnecessary OOM message. You also have some inconsistency in whether or not your logging messages use a terminating period. I suggest you just delete all the periods. s/\.\\n"/\\n"/g