diff options
| author | Julia Lawall <julia@diku.dk> | 2011-08-20 03:02:01 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-08-22 18:29:17 -0400 |
| commit | c09f5ca7bdc9a82c5f721bc28c46d65452240cfa (patch) | |
| tree | 7760c8821097eb7369dba7becaa6162fb0fe77a3 | |
| parent | 178b279b645a14ca8ea01e4ea818c88681a31b07 (diff) | |
sound/soc/fsl/mpc8610_hpcd.c: add missing of_node_put
The first change is to add an of_node_put, since codec_np has previously
been allocated. The rest of the patch reorganizes the error handling code
so the only code executed is that which is needed.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier x;
expression E1!=0,E2,E3,E4;
statement S;
iterator I;
@@
(
if (...) { ... when != of_node_put(x)
when != x = E3
when != E3 = x
* return ...;
}
... when != x = E2
when != I(...,x,...) S
if (...) { ... when != x = E4
of_node_put(x); ... return ...; }
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Timur Tabi <timur@freescale.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| -rw-r--r-- | sound/soc/fsl/mpc8610_hpcd.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index a19297959587..358f0baaf71b 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
| @@ -345,8 +345,10 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL); | 347 | machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL); |
| 348 | if (!machine_data) | 348 | if (!machine_data) { |
| 349 | return -ENOMEM; | 349 | ret = -ENOMEM; |
| 350 | goto error_alloc; | ||
| 351 | } | ||
| 350 | 352 | ||
| 351 | machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); | 353 | machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); |
| 352 | machine_data->dai[0].ops = &mpc8610_hpcd_ops; | 354 | machine_data->dai[0].ops = &mpc8610_hpcd_ops; |
| @@ -494,7 +496,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
| 494 | ret = platform_device_add(sound_device); | 496 | ret = platform_device_add(sound_device); |
| 495 | if (ret) { | 497 | if (ret) { |
| 496 | dev_err(&pdev->dev, "platform device add failed\n"); | 498 | dev_err(&pdev->dev, "platform device add failed\n"); |
| 497 | goto error; | 499 | goto error_sound; |
| 498 | } | 500 | } |
| 499 | dev_set_drvdata(&pdev->dev, sound_device); | 501 | dev_set_drvdata(&pdev->dev, sound_device); |
| 500 | 502 | ||
| @@ -502,14 +504,12 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
| 502 | 504 | ||
| 503 | return 0; | 505 | return 0; |
| 504 | 506 | ||
| 507 | error_sound: | ||
| 508 | platform_device_unregister(sound_device); | ||
| 505 | error: | 509 | error: |
| 506 | of_node_put(codec_np); | ||
| 507 | |||
| 508 | if (sound_device) | ||
| 509 | platform_device_unregister(sound_device); | ||
| 510 | |||
| 511 | kfree(machine_data); | 510 | kfree(machine_data); |
| 512 | 511 | error_alloc: | |
| 512 | of_node_put(codec_np); | ||
| 513 | return ret; | 513 | return ret; |
| 514 | } | 514 | } |
| 515 | 515 | ||
