From 0eb7d4263fc223f61917a4cd0171f5c2464acf21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Tue, 26 Aug 2014 02:20:06 +0200 Subject: [PATCH] Remove the helper variable --- klgd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/klgd.c b/klgd.c index 2050663..4586ec2 100644 --- a/klgd.c +++ b/klgd.c @@ -32,17 +32,16 @@ static void klgd_schedule_update(struct klgd_main_private *priv); struct klgd_command * klgd_alloc_cmd(const size_t length) { struct klgd_command *cmd = kzalloc(sizeof(struct klgd_command), GFP_KERNEL); - char *bytes; if (!cmd) return NULL; /* Cast away the const-ness */ - bytes = kzalloc(sizeof(char) * length, GFP_KERNEL); - if (!bytes) { + *(char **)(&cmd->bytes) = kzalloc(sizeof(char) * length, GFP_KERNEL); + if (!cmd->bytes) { kfree(cmd); return NULL; } - *(char **)(&cmd->bytes) = bytes; + cmd->length = length; return cmd; } -- 2.43.5