Skip to content

Commit

Permalink
spi: mediatek: Use devm_platform_ioremap_resource() in mtk_spi_slave_…
Browse files Browse the repository at this point in the history
…probe()

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Link: https://lore.kernel.org/r/225b76ca-a367-4bef-d8ce-42c7af9242a5@web.de
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Markus Elfring authored and Mark Brown committed Oct 1, 2019
1 parent 5dd381e commit 6cdcb5d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions drivers/spi/spi-slave-mt27xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
{
struct spi_controller *ctlr;
struct mtk_spi_slave *mdata;
struct resource *res;
int irq, ret;

ctlr = spi_alloc_slave(&pdev->dev, sizeof(*mdata));
Expand All @@ -392,17 +391,8 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ctlr);

init_completion(&mdata->xfer_done);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
ret = -ENODEV;
dev_err(&pdev->dev, "failed to determine base address\n");
goto err_put_ctlr;
}

mdata->dev = &pdev->dev;

mdata->base = devm_ioremap_resource(&pdev->dev, res);
mdata->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mdata->base)) {
ret = PTR_ERR(mdata->base);
goto err_put_ctlr;
Expand Down

0 comments on commit 6cdcb5d

Please sign in to comment.