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

spi: xtensa-xtfpga: Use devm_platform_ioremap_resource() in xtfpga_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/178bb78e-714f-645f-d819-5732870c4272@web.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Markus Elfring and committed by
Mark Brown
3f049e7d 6cdcb5d3

+1 -9
+1 -9
drivers/spi/spi-xtensa-xtfpga.c
··· 80 80 static int xtfpga_spi_probe(struct platform_device *pdev) 81 81 { 82 82 struct xtfpga_spi *xspi; 83 - struct resource *mem; 84 83 int ret; 85 84 struct spi_master *master; 86 85 ··· 96 97 xspi->bitbang.master = master; 97 98 xspi->bitbang.chipselect = xtfpga_spi_chipselect; 98 99 xspi->bitbang.txrx_word[SPI_MODE_0] = xtfpga_spi_txrx_word; 99 - 100 - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 101 - if (!mem) { 102 - dev_err(&pdev->dev, "No memory resource\n"); 103 - ret = -ENODEV; 104 - goto err; 105 - } 106 - xspi->regs = devm_ioremap_resource(&pdev->dev, mem); 100 + xspi->regs = devm_platform_ioremap_resource(pdev, 0); 107 101 if (IS_ERR(xspi->regs)) { 108 102 ret = PTR_ERR(xspi->regs); 109 103 goto err;