Skip to content

Commit

Permalink
i2c/aspeed: Simplify resource acquisition
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Stanley <[email protected]>
  • Loading branch information
shenki committed Feb 10, 2016
1 parent 4b61633 commit 7c5a38f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/i2c/busses/i2c-aspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ static const struct i2c_algorithm i2c_ast_algorithm = {
static int ast_i2c_probe_bus(struct platform_device *pdev)
{
struct ast_i2c_bus *bus;
struct resource res;
struct resource *res;
int ret, bus_num;

bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
Expand All @@ -693,17 +693,14 @@ static int ast_i2c_probe_bus(struct platform_device *pdev)
if (ret)
return -ENXIO;

ret = of_address_to_resource(pdev->dev.of_node, 0, &res);
if (ret < 0)
return -ENXIO;

bus->pclk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(bus->pclk)) {
dev_dbg(&pdev->dev, "clk_get failed\n");
return PTR_ERR(bus->pclk);
}

bus->base = devm_ioremap_resource(&pdev->dev, &res);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
bus->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(bus->base))
return PTR_ERR(bus->base);

Expand Down

0 comments on commit 7c5a38f

Please sign in to comment.