linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Guo <shawn.guo@linaro.org>
To: Richard Zhao <richard.zhao@freescale.com>
Cc: linux-serial@vger.kernel.org, alan@linux.intel.com,
	gregkh@linuxfoundation.org, kernel@pengutronix.de
Subject: Re: [PATCH 2/2] serial: imx: remove null check of sport in suspend/resume function
Date: Wed, 19 Sep 2012 11:37:58 +0800	[thread overview]
Message-ID: <20120919033757.GF6460@S2100-06.ap.freescale.net> (raw)
In-Reply-To: <1347956099-15257-2-git-send-email-richard.zhao@freescale.com>

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
> 
> 


  reply	other threads:[~2012-09-19  3:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-09-19  3:36 ` [PATCH 1/2] serial: imx: set sport as drvdata, like it's used elsewhere Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120919033757.GF6460@S2100-06.ap.freescale.net \
    --to=shawn.guo@linaro.org \
    --cc=alan@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-serial@vger.kernel.org \
    --cc=richard.zhao@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).