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 | 93 | dev_err(&op->dev, "platform_device_alloc() failed\n"); |
| 94 | 94 | |
| 95 | 95 | ret = platform_device_add(pdata->codec_device); |
| 96 | − if (ret) | |
| 96 | + if (ret) { | |
| 97 | 97 | dev_err(&op->dev, "platform_device_add() failed: %d\n", ret); |
| 98 | + platform_device_put(pdata->codec_device); | |
| 99 | + } | |
| 98 | 100 | |
| 99 | 101 | ret = snd_soc_register_card(card); |
| 100 | − if (ret) | |
| 102 | + if (ret) { | |
| 101 | 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 | 108 | platform_set_drvdata(op, pdata); |
| 104 | − | |
| 105 | 109 | return ret; |
| 110 | + | |
| 106 | 111 | } |
| 107 | 112 | |
| 108 | 113 | static int pcm030_fabric_remove(struct platform_device *op) |