Skip to content

Commit

Permalink
drivers/ata: Move a dereference below a NULL test
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Julia Lawall authored and Jeff Garzik committed Jul 15, 2009
1 parent d0cb43b commit 1e1f421
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/ata/pata_at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,12 @@ static int __devinit pata_at91_probe(struct platform_device *pdev)
static int __devexit pata_at91_remove(struct platform_device *pdev)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
struct at91_ide_info *info = host->private_data;
struct at91_ide_info *info;
struct device *dev = &pdev->dev;

if (!host)
return 0;
info = host->private_data;

ata_host_detach(host);

Expand Down

0 comments on commit 1e1f421

Please sign in to comment.