Skip to content

Commit

Permalink
drivers/spi: move a dereference below a NULL test
Browse files Browse the repository at this point in the history
In each case, if the NULL test is necessary, then the dereference should be
moved below the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Julia Lawall authored and Linus Torvalds committed Jan 6, 2009
1 parent ee9c1fb commit 51e911e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/spi/pxa2xx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1561,11 +1561,12 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
static int pxa2xx_spi_remove(struct platform_device *pdev)
{
struct driver_data *drv_data = platform_get_drvdata(pdev);
struct ssp_device *ssp = drv_data->ssp;
struct ssp_device *ssp;
int status = 0;

if (!drv_data)
return 0;
ssp = drv_data->ssp;

/* Remove the queue */
status = destroy_queue(drv_data);
Expand Down

0 comments on commit 51e911e

Please sign in to comment.