Skip to content

Commit 1726813

Browse files
bbkzzmiquelraynal
authored andcommitted
mtd: st_spi_fsm: Convert to devm_platform_ioremap_resource()
Use devm_platform_ioremap_resource() to simplify code. Signed-off-by: Yangtao Li <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent a29f696 commit 1726813

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

drivers/mtd/devices/st_spi_fsm.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,6 @@ static int stfsm_probe(struct platform_device *pdev)
20162016
{
20172017
struct device_node *np = pdev->dev.of_node;
20182018
struct flash_info *info;
2019-
struct resource *res;
20202019
struct stfsm *fsm;
20212020
int ret;
20222021

@@ -2033,18 +2032,9 @@ static int stfsm_probe(struct platform_device *pdev)
20332032

20342033
platform_set_drvdata(pdev, fsm);
20352034

2036-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2037-
if (!res) {
2038-
dev_err(&pdev->dev, "Resource not found\n");
2039-
return -ENODEV;
2040-
}
2041-
2042-
fsm->base = devm_ioremap_resource(&pdev->dev, res);
2043-
if (IS_ERR(fsm->base)) {
2044-
dev_err(&pdev->dev,
2045-
"Failed to reserve memory region %pR\n", res);
2035+
fsm->base = devm_platform_ioremap_resource(pdev, 0);
2036+
if (IS_ERR(fsm->base))
20462037
return PTR_ERR(fsm->base);
2047-
}
20482038

20492039
fsm->clk = devm_clk_get_enabled(&pdev->dev, NULL);
20502040
if (IS_ERR(fsm->clk)) {

0 commit comments

Comments
 (0)