mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 10:01:25 +00:00
memory: renesas-rpc-if: fix platform-device leak in error path
commitb452dbf24d
upstream. Make sure to free the flash platform device in the event that registration fails during probe. Fixes:ca7d8b980b
("memory: add Renesas RPC-IF driver") Cc: stable@vger.kernel.org # 5.8 Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20220303180632.3194-1-johan@kernel.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8a36284528
commit
d0d15280a5
1 changed files with 9 additions and 1 deletions
|
@ -579,6 +579,7 @@ static int rpcif_probe(struct platform_device *pdev)
|
||||||
struct platform_device *vdev;
|
struct platform_device *vdev;
|
||||||
struct device_node *flash;
|
struct device_node *flash;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
int ret;
|
||||||
|
|
||||||
flash = of_get_next_child(pdev->dev.of_node, NULL);
|
flash = of_get_next_child(pdev->dev.of_node, NULL);
|
||||||
if (!flash) {
|
if (!flash) {
|
||||||
|
@ -602,7 +603,14 @@ static int rpcif_probe(struct platform_device *pdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
vdev->dev.parent = &pdev->dev;
|
vdev->dev.parent = &pdev->dev;
|
||||||
platform_set_drvdata(pdev, vdev);
|
platform_set_drvdata(pdev, vdev);
|
||||||
return platform_device_add(vdev);
|
|
||||||
|
ret = platform_device_add(vdev);
|
||||||
|
if (ret) {
|
||||||
|
platform_device_put(vdev);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rpcif_remove(struct platform_device *pdev)
|
static int rpcif_remove(struct platform_device *pdev)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue