mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-06 06:37:59 +00:00
net: mvneta: use devm_platform_ioremap_resource() to simplify code
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>
This commit is contained in:
parent
4f830a5af7
commit
37f76049b0
1 changed files with 1 additions and 3 deletions
|
@ -411,15 +411,13 @@ static int mvneta_bm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *dn = pdev->dev.of_node;
|
struct device_node *dn = pdev->dev.of_node;
|
||||||
struct mvneta_bm *priv;
|
struct mvneta_bm *priv;
|
||||||
struct resource *res;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL);
|
priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL);
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
priv->reg_base = devm_platform_ioremap_resource(pdev, 0);
|
||||||
priv->reg_base = devm_ioremap_resource(&pdev->dev, res);
|
|
||||||
if (IS_ERR(priv->reg_base))
|
if (IS_ERR(priv->reg_base))
|
||||||
return PTR_ERR(priv->reg_base);
|
return PTR_ERR(priv->reg_base);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue