* [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere
@ 2012-09-18 8:14 Richard Zhao
2012-09-18 8:14 ` [PATCH 2/2] serial: imx: remove null check of sport in suspend/resume function Richard Zhao
2012-09-19 3:36 ` [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere Shawn Guo
0 siblings, 2 replies; 4+ messages in thread
From: Richard Zhao @ 2012-09-18 8:14 UTC (permalink / raw)
To: linux-serial; +Cc: alan, gregkh, shawn.guo, kernel, Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
---
drivers/tty/serial/imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 5952b25..49f664f 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1540,7 +1540,7 @@ static int serial_imx_probe(struct platform_device *pdev)
ret = uart_add_one_port(&imx_reg, &sport->port);
if (ret)
goto deinit;
- platform_set_drvdata(pdev, &sport->port);
+ platform_set_drvdata(pdev, sport);
return 0;
deinit:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] serial: imx: remove null check of sport in suspend/resume function
2012-09-18 8:14 [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere Richard Zhao
@ 2012-09-18 8:14 ` Richard Zhao
2012-09-19 3:37 ` Shawn Guo
2012-09-19 3:36 ` [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere Shawn Guo
1 sibling, 1 reply; 4+ messages in thread
From: Richard Zhao @ 2012-09-18 8:14 UTC (permalink / raw)
To: linux-serial; +Cc: alan, gregkh, shawn.guo, kernel, Richard Zhao
platform_get_drvdata always retrun a valid value after probe succeed.
It also fixed smatch warnings:
drivers/tty/serial/imx.c:1376 serial_imx_suspend() warn: variable dereferenced before check 'sport' (see line 1372)
drivers/tty/serial/imx.c:1392 serial_imx_resume() warn: variable dereferenced before check 'sport' (see line 1388)
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
---
drivers/tty/serial/imx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 49f664f..efeb8be 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1373,8 +1373,7 @@ static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
val |= UCR3_AWAKEN;
writel(val, sport->port.membase + UCR3);
- if (sport)
- uart_suspend_port(&imx_reg, &sport->port);
+ uart_suspend_port(&imx_reg, &sport->port);
return 0;
}
@@ -1389,8 +1388,7 @@ static int serial_imx_resume(struct platform_device *dev)
val &= ~UCR3_AWAKEN;
writel(val, sport->port.membase + UCR3);
- if (sport)
- uart_resume_port(&imx_reg, &sport->port);
+ uart_resume_port(&imx_reg, &sport->port);
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere
2012-09-18 8:14 [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere Richard Zhao
2012-09-18 8:14 ` [PATCH 2/2] serial: imx: remove null check of sport in suspend/resume function Richard Zhao
@ 2012-09-19 3:36 ` Shawn Guo
1 sibling, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2012-09-19 3:36 UTC (permalink / raw)
To: Richard Zhao; +Cc: linux-serial, alan, gregkh, kernel
On Tue, Sep 18, 2012 at 04:14:58PM +0800, Richard Zhao wrote:
> Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
I think it's worth to have a sensible commit log explaining why it
has not trigger any issue.
It happens to work without problem because "struct uart_port port" is
the first member of "struct imx_port".
Otherwise,
Acked-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> drivers/tty/serial/imx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 5952b25..49f664f 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1540,7 +1540,7 @@ static int serial_imx_probe(struct platform_device *pdev)
> ret = uart_add_one_port(&imx_reg, &sport->port);
> if (ret)
> goto deinit;
> - platform_set_drvdata(pdev, &sport->port);
> + platform_set_drvdata(pdev, sport);
>
> return 0;
> deinit:
> --
> 1.7.9.5
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] serial: imx: remove null check of sport in suspend/resume function
2012-09-18 8:14 ` [PATCH 2/2] serial: imx: remove null check of sport in suspend/resume function Richard Zhao
@ 2012-09-19 3:37 ` Shawn Guo
0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2012-09-19 3:37 UTC (permalink / raw)
To: Richard Zhao; +Cc: linux-serial, alan, gregkh, kernel
On Tue, Sep 18, 2012 at 04:14:59PM +0800, Richard Zhao wrote:
> platform_get_drvdata always retrun a valid value after probe succeed.
>
> It also fixed smatch warnings:
> drivers/tty/serial/imx.c:1376 serial_imx_suspend() warn: variable dereferenced before check 'sport' (see line 1372)
> drivers/tty/serial/imx.c:1392 serial_imx_resume() warn: variable dereferenced before check 'sport' (see line 1388)
>
> Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> drivers/tty/serial/imx.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 49f664f..efeb8be 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1373,8 +1373,7 @@ static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
> val |= UCR3_AWAKEN;
> writel(val, sport->port.membase + UCR3);
>
> - if (sport)
> - uart_suspend_port(&imx_reg, &sport->port);
> + uart_suspend_port(&imx_reg, &sport->port);
>
> return 0;
> }
> @@ -1389,8 +1388,7 @@ static int serial_imx_resume(struct platform_device *dev)
> val &= ~UCR3_AWAKEN;
> writel(val, sport->port.membase + UCR3);
>
> - if (sport)
> - uart_resume_port(&imx_reg, &sport->port);
> + uart_resume_port(&imx_reg, &sport->port);
>
> return 0;
> }
> --
> 1.7.9.5
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-19 3:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-18 8:14 [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere Richard Zhao
2012-09-18 8:14 ` [PATCH 2/2] serial: imx: remove null check of sport in suspend/resume function Richard Zhao
2012-09-19 3:37 ` Shawn Guo
2012-09-19 3:36 ` [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere Shawn Guo
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).