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

RapidIO/mpc85xx: fix possible mport registration problems

Fix a possible problem with mport registration left non-cleared after
fsl_rio_setup() exits on link error. Abort mport initialization if
registration failed.

This patch is applicable to 2.6.39-rc1 only. The problem does not exist
for earlier versions.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alexandre Bounine and committed by
Linus Torvalds
59f99965 13209c2a

+7 -4
+3 -1
arch/powerpc/sysdev/fsl_rio.c
··· 1457 1457 port->ops = ops; 1458 1458 port->priv = priv; 1459 1459 port->phys_efptr = 0x100; 1460 - rio_register_mport(port); 1461 1460 1462 1461 priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1); 1463 1462 rio_regs_win = priv->regs_win; ··· 1502 1503 & RIO_PEF_CTLS) >> 4; 1503 1504 dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n", 1504 1505 port->sys_size ? 65536 : 256); 1506 + 1507 + if (rio_register_mport(port)) 1508 + goto err; 1505 1509 1506 1510 if (port->host_deviceid >= 0) 1507 1511 out_be32(priv->regs_win + RIO_GCCSR, RIO_PORT_GEN_HOST |
+3 -2
drivers/rapidio/rio.c
··· 1171 1171 1172 1172 __setup("riohdid=", rio_hdid_setup); 1173 1173 1174 - void rio_register_mport(struct rio_mport *port) 1174 + int rio_register_mport(struct rio_mport *port) 1175 1175 { 1176 1176 if (next_portid >= RIO_MAX_MPORTS) { 1177 1177 pr_err("RIO: reached specified max number of mports\n"); 1178 - return; 1178 + return 1; 1179 1179 } 1180 1180 1181 1181 port->id = next_portid++; 1182 1182 port->host_deviceid = rio_get_hdid(port->id); 1183 1183 list_add_tail(&port->node, &rio_mports); 1184 + return 0; 1184 1185 } 1185 1186 1186 1187 EXPORT_SYMBOL_GPL(rio_local_get_device_id);
+1 -1
include/linux/rio.h
··· 396 396 }; 397 397 398 398 /* Architecture and hardware-specific functions */ 399 - extern void rio_register_mport(struct rio_mport *); 399 + extern int rio_register_mport(struct rio_mport *); 400 400 extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 401 401 extern void rio_close_inb_mbox(struct rio_mport *, int); 402 402 extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);