From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932923AbYGQT2V (ORCPT ); Thu, 17 Jul 2008 15:28:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932409AbYGQTXF (ORCPT ); Thu, 17 Jul 2008 15:23:05 -0400 Received: from nelson.telenet-ops.be ([195.130.133.66]:34929 "EHLO nelson.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932248AbYGQTWw (ORCPT ); Thu, 17 Jul 2008 15:22:52 -0400 Message-Id: <20080717191757.355426658@mail.of.borg> References: <20080717191607.955742542@mail.of.borg> User-Agent: quilt/0.46-1 Date: Thu, 17 Jul 2008 21:16:33 +0200 From: Geert Uytterhoeven To: Linus Torvalds , Andrew Morton Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall Subject: [patch 26/29] arch/m68k/mm/motorola.c: Eliminate NULL test and memset after alloc_bootmem Content-Disposition: inline; filename=m68k-motorola-eliminate-NULL-test-and-memset-after-alloc_bootmem.diff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem and related functions never return NULL and always return a zeroed region of memory. Thus a NULL test or memset after calls to these functions is unnecessary. This was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; statement S; @@ E = \(alloc_bootmem\|alloc_bootmem_low\|alloc_bootmem_pages\|alloc_bootmem_low_pages\)(...) .. when != E ( - BUG_ON (E == NULL); | - if (E == NULL) S ) @@ expression E,E1; @@ E = \(alloc_bootmem\|alloc_bootmem_low\|alloc_bootmem_pages\|alloc_bootmem_low_pages\)(...) .. when != E - memset(E,0,E1); // Signed-off-by: Julia Lawall Signed-off-by: Geert Uytterhoeven --- arch/m68k/mm/motorola.c | 1 - 1 file changed, 1 deletion(-) --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -285,7 +285,6 @@ void __init paging_init(void) * to a couple of allocated pages */ empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); - memset(empty_zero_page, 0, PAGE_SIZE); /* * Set up SFC/DFC registers -- Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds