PCI: dwc: pci-dra7xx: Use devm_platform_ioremap_resource_byname()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 29 Apr 2020 01:50:27 +0000 (01:50 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:53 +0000 (17:48 +0200)
commite2006bb79235bbb6792bddeb06e3b57a02d49714
tree8e9ffbac7017b35f7f58487a5c885fed9c4c52f5
parent12b1de9ca00be16624fd14d2dfd03b6c33b78799
PCI: dwc: pci-dra7xx: Use devm_platform_ioremap_resource_byname()

[ Upstream commit c8a119779f5609de8dcd98630f71cc7f1b2e4e8c ]

platform_get_resource() may fail and return NULL, so we had better
check its return value to avoid a NULL pointer dereference a bit later
in the code. Fix it to use devm_platform_ioremap_resource_byname()
instead of calling platform_get_resource_byname() and devm_ioremap().

Link: https://lore.kernel.org/r/20200429015027.134485-1-weiyongjun1@huawei.com
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
[lorenzo.pieralisi@arm.com: commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/controller/dwc/pci-dra7xx.c