Skip to content

Commit

Permalink
net: dsa: bcm_sf2: use devm_platform_ioremap_resource() to simplify code
Browse files Browse the repository at this point in the history
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YueHaibing authored and David S. Miller committed Aug 1, 2019
1 parent 291f4b6 commit 4237678
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/dsa/bcm_sf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,6 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
struct b53_device *dev;
struct dsa_switch *ds;
void __iomem **base;
struct resource *r;
unsigned int i;
u32 reg, rev;
int ret;
Expand Down Expand Up @@ -1107,8 +1106,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)

base = &priv->core;
for (i = 0; i < BCM_SF2_REGS_NUM; i++) {
r = platform_get_resource(pdev, IORESOURCE_MEM, i);
*base = devm_ioremap_resource(&pdev->dev, r);
*base = devm_platform_ioremap_resource(pdev, i);
if (IS_ERR(*base)) {
pr_err("unable to find register: %s\n", reg_names[i]);
return PTR_ERR(*base);
Expand Down

0 comments on commit 4237678

Please sign in to comment.