Commit 039a692a authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-stmmac-dwmac-anarion-address-issues-flagged-by-sparse'

Simon Horman says:

====================
net: stmmac: dwmac-anarion: address issues flagged by sparse

Two minor enhancements to dwmac-anarion to address issues flagged by
sparse.

1. Always return struct anarion_gmac * from anarion_config_dt()
2. Add __iomem annotation to register base

No functional change intended.
Compile tested only.
====================

Link: https://lore.kernel.org/r/20230406-dwmac-anarion-sparse-v1-0-b0c866c8be9d@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 07e75db6 51fe084b
...@@ -20,18 +20,18 @@ ...@@ -20,18 +20,18 @@
#define GMAC_CONFIG_INTF_RGMII (0x1 << 0) #define GMAC_CONFIG_INTF_RGMII (0x1 << 0)
struct anarion_gmac { struct anarion_gmac {
uintptr_t ctl_block; void __iomem *ctl_block;
uint32_t phy_intf_sel; uint32_t phy_intf_sel;
}; };
static uint32_t gmac_read_reg(struct anarion_gmac *gmac, uint8_t reg) static uint32_t gmac_read_reg(struct anarion_gmac *gmac, uint8_t reg)
{ {
return readl((void *)(gmac->ctl_block + reg)); return readl(gmac->ctl_block + reg);
}; };
static void gmac_write_reg(struct anarion_gmac *gmac, uint8_t reg, uint32_t val) static void gmac_write_reg(struct anarion_gmac *gmac, uint8_t reg, uint32_t val)
{ {
writel(val, (void *)(gmac->ctl_block + reg)); writel(val, gmac->ctl_block + reg);
} }
static int anarion_gmac_init(struct platform_device *pdev, void *priv) static int anarion_gmac_init(struct platform_device *pdev, void *priv)
...@@ -68,16 +68,16 @@ static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev) ...@@ -68,16 +68,16 @@ static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev)
ctl_block = devm_platform_ioremap_resource(pdev, 1); ctl_block = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(ctl_block)) { if (IS_ERR(ctl_block)) {
dev_err(&pdev->dev, "Cannot get reset region (%ld)!\n", err = PTR_ERR(ctl_block);
PTR_ERR(ctl_block)); dev_err(&pdev->dev, "Cannot get reset region (%d)!\n", err);
return ctl_block; return ERR_PTR(err);
} }
gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL); gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL);
if (!gmac) if (!gmac)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
gmac->ctl_block = (uintptr_t)ctl_block; gmac->ctl_block = ctl_block;
err = of_get_phy_mode(pdev->dev.of_node, &phy_mode); err = of_get_phy_mode(pdev->dev.of_node, &phy_mode);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment