Add the missing platform_device_put() and platform_device_del() before return from pcm030_fabric_probe in the error handling case.
Unified · Split
| @@ -93,16 +93,21 @@ static int pcm030_fabric_probe(struct platform_device *op) · 92 unmodified lines | |||
| 93 | dev_err(&op->dev, "platform_device_alloc() failed\n"); | 93 | dev_err(&op->dev, "platform_device_alloc() failed\n"); |
| 94 | 94 | ||
| 95 | ret = platform_device_add(pdata->codec_device); | 95 | ret = platform_device_add(pdata->codec_device); |
| 96 | if (ret) | 96 | if (ret) { |
| 97 | dev_err(&op->dev, "platform_device_add() failed: %d\n", ret); | 97 | dev_err(&op->dev, "platform_device_add() failed: %d\n", ret); |
| 98 | platform_device_put(pdata->codec_device); | ||
| 99 | } | ||
| 98 | 100 | ||
| 99 | ret = snd_soc_register_card(card); | 101 | ret = snd_soc_register_card(card); |
| 100 | if (ret) | 102 | if (ret) { |
| 101 | dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); | 103 | dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); |
| 104 | platform_device_del(pdata->codec_device); | ||
| 105 | platform_device_put(pdata->codec_device); | ||
| 106 | } | ||
| 102 | 107 | ||
| 103 | platform_set_drvdata(op, pdata); | 108 | platform_set_drvdata(op, pdata); |
| 104 | |||
| 105 | return ret; | 109 | return ret; |
| 110 | |||
| 106 | } | 111 | } |
| 107 | 112 | ||
| 108 | static int pcm030_fabric_remove(struct platform_device *op) | 113 | static int pcm030_fabric_remove(struct platform_device *op) |