From e87b686b5109e171438a0529828d3109b7ad6da3 Mon Sep 17 00:00:00 2001 From: Alexandru Gheorghiu Date: Sat, 9 Mar 2013 11:40:43 +0200 Subject: [PATCH 1/4] x86/platform/uv: Replace kmalloc() & memset with kzalloc() This was found using coccicheck. Signed-off-by: Alexandru Gheorghiu Link: http://lkml.kernel.org/r/1362822043-15559-1-git-send-email-gheorghiuandru@gmail.com Signed-off-by: Ingo Molnar --- arch/x86/platform/uv/uv_time.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c index 98718f604eb6..5c86786bbfd2 100644 --- a/arch/x86/platform/uv/uv_time.c +++ b/arch/x86/platform/uv/uv_time.c @@ -159,10 +159,9 @@ static __init int uv_rtc_allocate_timers(void) { int cpu; - blade_info = kmalloc(uv_possible_blades * sizeof(void *), GFP_KERNEL); + blade_info = kzalloc(uv_possible_blades * sizeof(void *), GFP_KERNEL); if (!blade_info) return -ENOMEM; - memset(blade_info, 0, uv_possible_blades * sizeof(void *)); for_each_present_cpu(cpu) { int nid = cpu_to_node(cpu); From ad0304cfd90f46bfcae3a6cd2b69067741541730 Mon Sep 17 00:00:00 2001 From: Zhang Yanfei Date: Tue, 12 Mar 2013 12:58:02 +0800 Subject: [PATCH 2/4] x86/platform/intel/mrst: Remove cast for kmalloc() return value Signed-off-by: Zhang Yanfei Cc: Andrew Morton Link: http://lkml.kernel.org/r/513EB5DA.2010300@cn.fujitsu.com Signed-off-by: Ingo Molnar --- arch/x86/platform/mrst/mrst.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index e31bcd8f2eee..a0a0a4389bbd 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c @@ -356,8 +356,7 @@ static int __init sfi_parse_gpio(struct sfi_table_header *table) num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry); pentry = (struct sfi_gpio_table_entry *)sb->pentry; - gpio_table = (struct sfi_gpio_table_entry *) - kmalloc(num * sizeof(*pentry), GFP_KERNEL); + gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL); if (!gpio_table) return -1; memcpy(gpio_table, pentry, num * sizeof(*pentry)); From 3482e664dc7f44e0ffb1fcf1de7af74977748f31 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Wed, 24 Apr 2013 10:46:24 +0800 Subject: [PATCH 3/4] x86/olpc/xo1/sci: Don't call input_free_device() after input_unregister_device() input_free_device() should only be used if input_register_device() was not called yet or if it failed. Once device was unregistered use input_unregister_device() and memory will be freed once last reference to the device is dropped. Signed-off-by: Wei Yongjun Cc: dsd@laptop.org Cc: pgf@laptop.org Cc: gregkh@linuxfoundation.org Link: http://lkml.kernel.org/r/CAPgLHd84cboeucog%2BYNdHvGqTfTROujDKZgSkh3o0B-Q93ee2A@mail.gmail.com Signed-off-by: Ingo Molnar --- arch/x86/platform/olpc/olpc-xo1-sci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c index 74704be7b1fe..9a2e590dd202 100644 --- a/arch/x86/platform/olpc/olpc-xo1-sci.c +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c @@ -460,7 +460,6 @@ static int setup_power_button(struct platform_device *pdev) static void free_power_button(void) { input_unregister_device(power_button_idev); - input_free_device(power_button_idev); } static int setup_ebook_switch(struct platform_device *pdev) @@ -491,7 +490,6 @@ static int setup_ebook_switch(struct platform_device *pdev) static void free_ebook_switch(void) { input_unregister_device(ebook_switch_idev); - input_free_device(ebook_switch_idev); } static int setup_lid_switch(struct platform_device *pdev) @@ -526,6 +524,7 @@ static int setup_lid_switch(struct platform_device *pdev) err_create_attr: input_unregister_device(lid_switch_idev); + lid_switch_idev = NULL; err_register: input_free_device(lid_switch_idev); return r; @@ -535,7 +534,6 @@ static void free_lid_switch(void) { device_remove_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode); input_unregister_device(lid_switch_idev); - input_free_device(lid_switch_idev); } static int xo1_sci_probe(struct platform_device *pdev) From 06d219dc22daa26b79ec8e611caa68801607f15d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 25 Apr 2013 11:24:05 +0200 Subject: [PATCH 4/4] x86/setup: Drop unneeded include arch/x86/kernel/setup.c includes but it doesn't look like it needs it, is sufficient. Signed-off-by: Jean Delvare Link: http://lkml.kernel.org/r/1366881845.4186.65.camel@chaos.site Signed-off-by: Ingo Molnar Cc: "H. Peter Anvin" --- arch/x86/kernel/setup.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 90d8cc930f5e..a60b245951e1 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -82,7 +82,6 @@ #include #include #include -#include #include #include #include