|
@@ -379,6 +379,7 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,
|
|
if (!clock_frequency_present) {
|
|
if (!clock_frequency_present) {
|
|
dev_err(&pdev->dev,
|
|
dev_err(&pdev->dev,
|
|
"Missing required parameter 'opencores,ip-clock-frequency'\n");
|
|
"Missing required parameter 'opencores,ip-clock-frequency'\n");
|
|
|
|
+ clk_disable_unprepare(i2c->clk);
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
}
|
|
}
|
|
i2c->ip_clock_khz = clock_frequency / 1000;
|
|
i2c->ip_clock_khz = clock_frequency / 1000;
|
|
@@ -467,20 +468,21 @@ static int ocores_i2c_probe(struct platform_device *pdev)
|
|
default:
|
|
default:
|
|
dev_err(&pdev->dev, "Unsupported I/O width (%d)\n",
|
|
dev_err(&pdev->dev, "Unsupported I/O width (%d)\n",
|
|
i2c->reg_io_width);
|
|
i2c->reg_io_width);
|
|
- return -EINVAL;
|
|
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
+ goto err_clk;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
ret = ocores_init(&pdev->dev, i2c);
|
|
ret = ocores_init(&pdev->dev, i2c);
|
|
if (ret)
|
|
if (ret)
|
|
- return ret;
|
|
|
|
|
|
+ goto err_clk;
|
|
|
|
|
|
init_waitqueue_head(&i2c->wait);
|
|
init_waitqueue_head(&i2c->wait);
|
|
ret = devm_request_irq(&pdev->dev, irq, ocores_isr, 0,
|
|
ret = devm_request_irq(&pdev->dev, irq, ocores_isr, 0,
|
|
pdev->name, i2c);
|
|
pdev->name, i2c);
|
|
if (ret) {
|
|
if (ret) {
|
|
dev_err(&pdev->dev, "Cannot claim IRQ\n");
|
|
dev_err(&pdev->dev, "Cannot claim IRQ\n");
|
|
- return ret;
|
|
|
|
|
|
+ goto err_clk;
|
|
}
|
|
}
|
|
|
|
|
|
/* hook up driver to tree */
|
|
/* hook up driver to tree */
|
|
@@ -494,7 +496,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
|
|
ret = i2c_add_adapter(&i2c->adap);
|
|
ret = i2c_add_adapter(&i2c->adap);
|
|
if (ret) {
|
|
if (ret) {
|
|
dev_err(&pdev->dev, "Failed to add adapter\n");
|
|
dev_err(&pdev->dev, "Failed to add adapter\n");
|
|
- return ret;
|
|
|
|
|
|
+ goto err_clk;
|
|
}
|
|
}
|
|
|
|
|
|
/* add in known devices to the bus */
|
|
/* add in known devices to the bus */
|
|
@@ -504,6 +506,10 @@ static int ocores_i2c_probe(struct platform_device *pdev)
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
|
+
|
|
|
|
+err_clk:
|
|
|
|
+ clk_disable_unprepare(i2c->clk);
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static int ocores_i2c_remove(struct platform_device *pdev)
|
|
static int ocores_i2c_remove(struct platform_device *pdev)
|