Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NTB: Multiple NTB client fix

Fix issue with adding multiple ntb client devices to the ntb virtual
bus. Previously, multiple devices would be added with the same name,
resulting in crashes. To get around this issue, add a unique number to
the device when it is added.

Signed-off-by: Jon Mason <jon.mason@intel.com>

Jon Mason 8b19d450 904435cf

+3 -2
+3 -2
drivers/ntb/ntb_transport.c
··· 300 300 { 301 301 struct ntb_transport_client_dev *client_dev; 302 302 struct ntb_transport *nt; 303 - int rc; 303 + int rc, i = 0; 304 304 305 305 if (list_empty(&ntb_transport_list)) 306 306 return -ENODEV; ··· 318 318 dev = &client_dev->dev; 319 319 320 320 /* setup and register client devices */ 321 - dev_set_name(dev, "%s", device_name); 321 + dev_set_name(dev, "%s%d", device_name, i); 322 322 dev->bus = &ntb_bus_type; 323 323 dev->release = ntb_client_release; 324 324 dev->parent = &ntb_query_pdev(nt->ndev)->dev; ··· 330 330 } 331 331 332 332 list_add_tail(&client_dev->entry, &nt->client_devs); 333 + i++; 333 334 } 334 335 335 336 return 0;