From: Julia Lawall Date: Sun, 27 Dec 2009 11:27:44 +0000 (+0000) Subject: drivers/net/can: Correct NULL test X-Git-Tag: android-x86-2.2~2077^2~147 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ce739b473ce12d5ef067b39b8637bfd2b2174a15;p=android-x86%2Fkernel.git drivers/net/can: Correct NULL test 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/) // @@ expression x,y; statement S; @@ x = \(kmalloc\|kcalloc\|kzalloc\)(...); ( if ((x) == NULL) S | if ( - y + x == NULL) S ) // Signed-off-by: Julia Lawall Acked-by: Oliver Hartkopp Signed-off-by: David S. Miller --- diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index 9c5a1537939c..1a72ca066a17 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c @@ -990,7 +990,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi) goto error_tx_buf; } priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL); - if (!priv->spi_tx_buf) { + if (!priv->spi_rx_buf) { ret = -ENOMEM; goto error_rx_buf; }