lkml.org 
[lkml]   [2016]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 net-next 03/13] net: hisilicon: cleanup to prepare for other cases
From
From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Date: Mon, 30 May 2016 20:34:14 +0800

> -static void hns_mdio_bus_name(char *name, struct device_node *np)
> +static void hns_mdio_bus_name(char *name, phys_addr_t addr)
> {
> - const u32 *addr;
> - u64 taddr = OF_BAD_ADDR;
> -
> - addr = of_get_address(np, 0, NULL, NULL);
> - if (addr)
> - taddr = of_translate_address(np, addr);
> -
> - snprintf(name, MII_BUS_ID_SIZE, "%s@%llx", np->name,
> - (unsigned long long)taddr);
> + snprintf(name, MII_BUS_ID_SIZE,
> + "hns-mdio@%llx", (unsigned long long)addr);

This is a really bad idea.

You're passing in the resource address in here, which can be a bus
address.

And on a machine with multiple bus domains, the same address can be
used multiple times. They are not unique at all in a multi-domain
system.

\
 
 \ /
  Last update: 2016-06-02 01:21    [W:0.399 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site