Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: mediatek: Use devm_platform_ioremap_resource() in mtk_spi_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/478e0df1-e800-8cf1-f9b3-d72f8e26aa0b@web.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Markus Elfring and committed by
Mark Brown
5dd381e7 22262695

+1 -10
+1 -10
drivers/spi/spi-mt65xx.c
··· 619 619 struct spi_master *master; 620 620 struct mtk_spi *mdata; 621 621 const struct of_device_id *of_id; 622 - struct resource *res; 623 622 int i, irq, ret, addr_bits; 624 623 625 624 master = spi_alloc_master(&pdev->dev, sizeof(*mdata)); ··· 681 682 } 682 683 683 684 platform_set_drvdata(pdev, master); 684 - 685 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 686 - if (!res) { 687 - ret = -ENODEV; 688 - dev_err(&pdev->dev, "failed to determine base address\n"); 689 - goto err_put_master; 690 - } 691 - 692 - mdata->base = devm_ioremap_resource(&pdev->dev, res); 685 + mdata->base = devm_platform_ioremap_resource(pdev, 0); 693 686 if (IS_ERR(mdata->base)) { 694 687 ret = PTR_ERR(mdata->base); 695 688 goto err_put_master;