Title: [7480] trunk/drivers/spi/spi_bfin5xx.c: Check 'chip' in error handling code to prevent NULL pointer access.
Revision
7480
Author
adamliyi
Date
2009-09-28 00:08:13 -0400 (Mon, 28 Sep 2009)

Log Message

Check 'chip' in error handling code to prevent NULL pointer access.

Modified Paths


Diff

Modified: trunk/drivers/spi/spi_bfin5xx.c (7479 => 7480)


--- trunk/drivers/spi/spi_bfin5xx.c	2009-09-28 04:03:38 UTC (rev 7479)
+++ trunk/drivers/spi/spi_bfin5xx.c	2009-09-28 04:08:13 UTC (rev 7480)
@@ -1062,7 +1062,7 @@
 	int ret = -EINVAL;
 
 	if (spi->bits_per_word != 8 && spi->bits_per_word != 16)
-		goto error;
+		return -EINVAL;
 
 	/* Only alloc (or use chip_info) on first setup */
 	chip_info = NULL;
@@ -1212,6 +1212,9 @@
 
  error:
 	if (ret) {
+		if (!chip)
+			return ret;
+
 		if (drv_data->dma_requested)
 			free_dma(drv_data->dma_channel);
 		drv_data->dma_requested = 0;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to