Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 477612ab authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: phy: qusb: Don't try to ioremap NULL resource



platform_get_resource_byname() returns resource as NULL if it doesn't
find requested resource. If it is NULL, the subsequent devm_ioremap()
will print an "invalid resource" message to console which can be
misleading. Since these resources are optional, avoid the false error
message by only calling devm_ioremap() if the resources are found.

Change-Id: Ib696958085634b3593d99f124e54fc2216d0f292
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 979a567d
Loading
Loading
Loading
Loading
+13 −8
Original line number Original line Diff line number Diff line
@@ -786,19 +786,24 @@ static int qusb_phy_probe(struct platform_device *pdev)


	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
							"qscratch_base");
							"qscratch_base");
	if (res) {
		qphy->qscratch_base = devm_ioremap_resource(dev, res);
		qphy->qscratch_base = devm_ioremap_resource(dev, res);
	if (IS_ERR(qphy->qscratch_base))
		if (IS_ERR(qphy->qscratch_base)) {
			dev_dbg(dev, "couldn't ioremap qscratch_base\n");
			qphy->qscratch_base = NULL;
			qphy->qscratch_base = NULL;
		}
	}


	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
							"emu_phy_base");
							"emu_phy_base");
	if (res) {
		qphy->emu_phy_base = devm_ioremap_resource(dev, res);
		qphy->emu_phy_base = devm_ioremap_resource(dev, res);
		if (IS_ERR(qphy->emu_phy_base)) {
		if (IS_ERR(qphy->emu_phy_base)) {
			dev_dbg(dev, "couldn't ioremap emu_phy_base\n");
			qphy->emu_phy_base = NULL;
			qphy->emu_phy_base = NULL;
		dev_dbg(dev, "couldn't find emu_phy_base\n");
		}
	}
	}


	qphy->tune2_efuse_reg = NULL;
	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
							"tune2_efuse_addr");
							"tune2_efuse_addr");
	if (res) {
	if (res) {