mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 22:54:05 +08:00
thunderbolt: Log error if adding switch fails
If we fail to add a switch for some reason log an error instead of keeping silent. This is useful for debugging. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
68b91293c8
commit
af99f696b5
@ -1785,21 +1785,25 @@ int tb_switch_add(struct tb_switch *sw)
|
|||||||
* configuration based mailbox.
|
* configuration based mailbox.
|
||||||
*/
|
*/
|
||||||
ret = tb_switch_add_dma_port(sw);
|
ret = tb_switch_add_dma_port(sw);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
dev_err(&sw->dev, "failed to add DMA port\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sw->safe_mode) {
|
if (!sw->safe_mode) {
|
||||||
/* read drom */
|
/* read drom */
|
||||||
ret = tb_drom_read(sw);
|
ret = tb_drom_read(sw);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
tb_sw_warn(sw, "tb_eeprom_read_rom failed\n");
|
dev_err(&sw->dev, "reading DROM failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
tb_sw_dbg(sw, "uid: %#llx\n", sw->uid);
|
tb_sw_dbg(sw, "uid: %#llx\n", sw->uid);
|
||||||
|
|
||||||
ret = tb_switch_set_uuid(sw);
|
ret = tb_switch_set_uuid(sw);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
dev_err(&sw->dev, "failed to set UUID\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i <= sw->config.max_port_number; i++) {
|
for (i = 0; i <= sw->config.max_port_number; i++) {
|
||||||
if (sw->ports[i].disabled) {
|
if (sw->ports[i].disabled) {
|
||||||
@ -1807,14 +1811,18 @@ int tb_switch_add(struct tb_switch *sw)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ret = tb_init_port(&sw->ports[i]);
|
ret = tb_init_port(&sw->ports[i]);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
dev_err(&sw->dev, "failed to initialize port %d\n", i);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = device_add(&sw->dev);
|
ret = device_add(&sw->dev);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
dev_err(&sw->dev, "failed to add device: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (tb_route(sw)) {
|
if (tb_route(sw)) {
|
||||||
dev_info(&sw->dev, "new device found, vendor=%#x device=%#x\n",
|
dev_info(&sw->dev, "new device found, vendor=%#x device=%#x\n",
|
||||||
@ -1826,6 +1834,7 @@ int tb_switch_add(struct tb_switch *sw)
|
|||||||
|
|
||||||
ret = tb_switch_nvm_add(sw);
|
ret = tb_switch_nvm_add(sw);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
dev_err(&sw->dev, "failed to add NVM devices\n");
|
||||||
device_del(&sw->dev);
|
device_del(&sw->dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user