linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.4.x-stable] 8250_pci: fix warnings in backport of Broadcom TruManage support
@ 2014-08-25 17:33 Paul Gortmaker
  2014-09-16 10:06 ` Li Zefan
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Gortmaker @ 2014-08-25 17:33 UTC (permalink / raw)
  To: stable
  Cc: linux-serial, Paul Gortmaker, Stephen Hurd, Michael Chan,
	Ben Hutchings, Rui Xiang, Greg Kroah-Hartman

commit 7400ce7ee9595432b2a1402b6ffcac9faf38d9ae (v3.4.92-76-g7400ce7ee959)
was a backport of commit ebebd49a8eab5e9aa1b1f8f1614ccc3c2120f886 upstream
("8250/16?50: Add support for Broadcom TruManage redirected serial port")

However, in the context of 3.4.x kernels, the pci setup code was
expecting a struct uart_port and not a struct uart_8250_port, leading to
the following concerning warnings:

drivers/tty/serial/8250/8250_pci.c: In function ‘pci_brcm_trumanage_setup’:
drivers/tty/serial/8250/8250_pci.c:1086:2: warning: passing argument 3 of ‘pci_default_setup’ from incompatible pointer type [enabled by default]
  int ret = pci_default_setup(priv, board, port, idx);
  ^
drivers/tty/serial/8250/8250_pci.c:1036:1: note: expected ‘struct uart_port *’ but argument is of type ‘struct uart_8250_port *’
 pci_default_setup(struct serial_private *priv,
 ^
drivers/tty/serial/8250/8250_pci.c: At top level:
drivers/tty/serial/8250/8250_pci.c:1746:3: warning: initialization from incompatible pointer type [enabled by default]
   .setup  = pci_brcm_trumanage_setup,
   ^
drivers/tty/serial/8250/8250_pci.c:1746:3: warning: (near initialization for ‘pci_serial_quirks[56].setup’) [enabled by default]

I'd also expect the initialization to not function correctly, and
perhaps dereference random garbage due to this.  Since the uart_port
is a field within the uart_8250_port, the adaptation to fix these
warnings is a straightforward removal of a layer of indirection.

Cc: Stephen Hurd <shurd@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Rui Xiang <rui.xiang@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---

[Only build tested; I don't have this specific hardware, but the fix
 seems straightforward enough to be almost self evident, I hope...]

 drivers/tty/serial/8250/8250_pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index cf7f1cdc1469..8e581dd01814 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1081,12 +1081,12 @@ pci_omegapci_setup(struct serial_private *priv,
 static int
 pci_brcm_trumanage_setup(struct serial_private *priv,
 			 const struct pciserial_board *board,
-			 struct uart_8250_port *port, int idx)
+			 struct uart_port *port, int idx)
 {
 	int ret = pci_default_setup(priv, board, port, idx);
 
-	port->port.type = PORT_BRCM_TRUMANAGE;
-	port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
+	port->type = PORT_BRCM_TRUMANAGE;
+	port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
 	return ret;
 }
 
-- 
2.0.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 3.4.x-stable] 8250_pci: fix warnings in backport of Broadcom TruManage support
  2014-08-25 17:33 [PATCH 3.4.x-stable] 8250_pci: fix warnings in backport of Broadcom TruManage support Paul Gortmaker
@ 2014-09-16 10:06 ` Li Zefan
  0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2014-09-16 10:06 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: stable, linux-serial, Stephen Hurd, Michael Chan, Ben Hutchings,
	Rui Xiang, Greg Kroah-Hartman

On 2014/8/26 1:33, Paul Gortmaker wrote:
> commit 7400ce7ee9595432b2a1402b6ffcac9faf38d9ae (v3.4.92-76-g7400ce7ee959)
> was a backport of commit ebebd49a8eab5e9aa1b1f8f1614ccc3c2120f886 upstream
> ("8250/16?50: Add support for Broadcom TruManage redirected serial port")
> 
> However, in the context of 3.4.x kernels, the pci setup code was
> expecting a struct uart_port and not a struct uart_8250_port, leading to
> the following concerning warnings:
> 
> drivers/tty/serial/8250/8250_pci.c: In function ‘pci_brcm_trumanage_setup’:
> drivers/tty/serial/8250/8250_pci.c:1086:2: warning: passing argument 3 of ‘pci_default_setup’ from incompatible pointer type [enabled by default]
>   int ret = pci_default_setup(priv, board, port, idx);
>   ^
> drivers/tty/serial/8250/8250_pci.c:1036:1: note: expected ‘struct uart_port *’ but argument is of type ‘struct uart_8250_port *’
>  pci_default_setup(struct serial_private *priv,
>  ^
> drivers/tty/serial/8250/8250_pci.c: At top level:
> drivers/tty/serial/8250/8250_pci.c:1746:3: warning: initialization from incompatible pointer type [enabled by default]
>    .setup  = pci_brcm_trumanage_setup,
>    ^
> drivers/tty/serial/8250/8250_pci.c:1746:3: warning: (near initialization for ‘pci_serial_quirks[56].setup’) [enabled by default]
> 
> I'd also expect the initialization to not function correctly, and
> perhaps dereference random garbage due to this.  Since the uart_port
> is a field within the uart_8250_port, the adaptation to fix these
> warnings is a straightforward removal of a layer of indirection.
> 
> Cc: Stephen Hurd <shurd@broadcom.com>
> Cc: Michael Chan <mchan@broadcom.com>
> Cc: Ben Hutchings <ben@decadent.org.uk>
> Cc: Rui Xiang <rui.xiang@huawei.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Applied to 3.4. Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-16 10:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 17:33 [PATCH 3.4.x-stable] 8250_pci: fix warnings in backport of Broadcom TruManage support Paul Gortmaker
2014-09-16 10:06 ` Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).