Re: [PATCH 1/9] PCI: mvebu: move clock enable before register access

From: Sebastian Hesselbarth
Date: Tue Aug 13 2013 - 05:23:09 EST

On 08/13/13 09:11, Thomas Petazzoni wrote:
On Mon, 12 Aug 2013 20:46:47 +0200, Sebastian Hesselbarth wrote:
+ port->clk = of_clk_get_by_name(child, NULL);
+ if (IS_ERR(port->clk)) {
+ dev_err(&pdev->dev, "PCIe%d.%d: cannot get clock\n",
+ port->port, port->lane);
+ iounmap(port->base);

You shouldn't iounmap() here in case of error, since the register
mapping hasn't been done yet.

Dooh, it was in my testing branch, but I failed to transfer that when
separating the changes to single patches. Will update.

+ port->haslink = 0;
+ continue;
+ }
+ clk_prepare_enable(port->clk);

Nitpick, an empty new line between the closing } and the
clk_prepare_enable() line would be nice.

Ok, as Theirry mentioned to check for clk_prepare_enable's return value
that would give a new "if (..)" anyway. Although, it might be the first
driver ever checking for this return value ;)

port->base = mvebu_pcie_map_registers(pdev, child, port);
if (!port->base) {
dev_err(&pdev->dev, "PCIe%d.%d: cannot map registers\n",
@@ -916,22 +926,9 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
port->port, port->lane);

and maybe here you could unprepare+release the clock if we haven't
managed to remap registers?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at