MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create()
authorLin Yujun <linyujun809@huawei.com>
Wed, 14 Sep 2022 03:29:17 +0000 (11:29 +0800)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Mon, 19 Sep 2022 14:33:27 +0000 (16:33 +0200)
commit11bec9cba4de06b3c0e9e4041453c2caaa1cbec1
treeaaf3114195496d90e3b0bdee50e0a7ba81a18c90
parent1e6d11fe72e311c1989991ee318d239f650fa318
MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create()

In error case in bridge_platform_create after calling
platform_device_add()/platform_device_add_data()/
platform_device_add_resources(), release the failed
'pdev' or it will be leak, call platform_device_put()
to fix this problem.

Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd',
use platform_device_unregister() to release sgi_w1
resources when xtalk-bridge registration fails.

Fixes: 5dc76a96e95a ("MIPS: PCI: use information from 1-wire PROM for IOC3 detection")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/sgi-ip27/ip27-xtalk.c