From: Mauro Carvalho Chehab Date: Tue, 29 Dec 2009 11:25:13 +0000 (-0300) Subject: V4L/DVB (13856): ir-keytable: simplify and avoid a warning X-Git-Tag: v2.6.34-rc1~280^2~334 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3205e4fe0d831c0457e9139794437e9999559150;p=platform%2Fkernel%2Flinux-3.10.git V4L/DVB (13856): ir-keytable: simplify and avoid a warning /home/v4l/buildtest/v4l-dvb-master/v4l/ir-keytable.c: In function 'ir_setkeycode': /home/v4l/buildtest/v4l-dvb-master/v4l/ir-keytable.c:190: warning: 'newkeymap' may be used uninitialized in this function Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 4c11a01..161d70b 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -185,18 +185,14 @@ static void ir_delete_key(struct ir_scancode_table *rc_tab, int elem) int newsize = rc_tab->size - 1; int resize = ir_is_resize_needed(rc_tab, newsize); struct ir_scancode *oldkeymap = rc_tab->scan; - struct ir_scancode *newkeymap; + struct ir_scancode *newkeymap = NULL; - if (resize) { + if (resize) newkeymap = kzalloc(ir_roundup_tablesize(newsize) * sizeof(*newkeymap), GFP_ATOMIC); - /* There's no memory for resize. Keep the old table */ - if (!newkeymap) - resize = 0; - } - - if (!resize) { + /* There's no memory for resize. Keep the old table */ + if (!resize || !newkeymap) { newkeymap = oldkeymap; /* We'll modify the live table. Lock it */