mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] arch/arm: Correct NULL test
@ 2009-12-27 21:26 Julia Lawall
  2009-12-27 21:51 ` Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2009-12-27 21:26 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Test the just-allocated value for NULL rather than some other value.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y;
statement S;
@@

x = \(kmalloc\|kcalloc\|kzalloc\)(...);
(
if ((x) == NULL) S
|
if (
-   y
+   x
       == NULL)
 S
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/arm/plat-pxa/dma.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/arm/plat-pxa/dma.c b/arch/arm/plat-pxa/dma.c
--- a/arch/arm/plat-pxa/dma.c
+++ b/arch/arm/plat-pxa/dma.c
@@ -244,7 +244,7 @@ static void pxa_dma_init_debugfs(void)
 
 	dbgfs_chan = kmalloc(sizeof(*dbgfs_state) * num_dma_channels,
 			     GFP_KERNEL);
-	if (!dbgfs_state)
+	if (!dbgfs_chan)
 		goto err_alloc;
 
 	chandir = debugfs_create_dir("channels", dbgfs_root);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-28 17:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-27 21:26 [PATCH 1/5] arch/arm: Correct NULL test Julia Lawall
2009-12-27 21:51 ` Uwe Kleine-König
2009-12-27 22:07   ` Julia Lawall
2009-12-28 16:24     ` H Hartley Sweeten
2009-12-28 16:51       ` Julia Lawall
2009-12-28 17:09         ` H Hartley Sweeten
2009-12-27 22:25   ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®