From: Greg KH <gregkh@linuxfoundation.org>
To: Tamseel Shams <m.shams@samsung.com>
Cc: kgene@kernel.org, krzk@kernel.org, jslaby@suse.com,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, alim.akhtar@samsung.com
Subject: Re: [PATCH] serial: samsung: Checks the return value of function
Date: Mon, 4 Jan 2021 11:03:50 +0100 [thread overview]
Message-ID: <X/LoBqoVf9H6wI8U@kroah.com> (raw)
In-Reply-To: <20210104083551.1393-1-m.shams@samsung.com>
On Mon, Jan 04, 2021 at 02:05:51PM +0530, Tamseel Shams wrote:
> "uart_add_one_port" function call may fail and return
> some error code, so adding a check for return value.
> If it is returning some error code, then displaying the
> result and returning back from there.
>
> Signed-off-by: Tamseel Shams <m.shams@samsung.com>
> ---
> drivers/tty/serial/samsung_tty.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
> index 6ef614d8648c..a220ba166ffe 100644
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
> @@ -2072,7 +2072,11 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
> }
>
> dev_dbg(&pdev->dev, "%s: adding port\n", __func__);
> - uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
> + ret = uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Failed to add uart port, err %d\n", ret);
> + return ret;
Why are you not unwinding the other logic that happened above? If this
fails, you need to properly do that as well, otherwise the driver is
still registered, right?
thanks,
greg k-h
prev parent reply other threads:[~2021-01-04 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210104082958epcas5p12c5c0e78dec7f106375b4f507a3b152b@epcas5p1.samsung.com>
2021-01-04 8:35 ` Tamseel Shams
2021-01-04 10:03 ` Greg KH [this message]
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=X/LoBqoVf9H6wI8U@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alim.akhtar@samsung.com \
--cc=jslaby@suse.com \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=m.shams@samsung.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
all inboxes | Powered by JetHome®