linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chunyan Zhang <zhang.lyra@gmail.com>
To: Baolin Wang <baolin.wang7@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <chunyan.zhang@unisoc.com>
Subject: Re: [PATCH v2 2/2] serial: sprd: cleanup the sprd_port for error case
Date: Wed, 18 Mar 2020 17:47:52 +0800	[thread overview]
Message-ID: <CAAfSe-u-ui3SP8vnNPMuKHhB-iMCscc4OE16hoDWZ8xzsie+vQ@mail.gmail.com> (raw)
In-Reply-To: <CADBw62rSE+MrQB_HSOwVNos_W=x-mHMEuVrZN=jU0Yt1KXFGvw@mail.gmail.com>

On Wed, 18 Mar 2020 at 17:16, Baolin Wang <baolin.wang7@gmail.com> wrote:
>
> On Wed, Mar 18, 2020 at 4:31 PM Chunyan Zhang <zhang.lyra@gmail.com> wrote:
> >
> > From: Chunyan Zhang <chunyan.zhang@unisoc.com>
> >
> > It would be better to cleanup the sprd_port for the device before
> > return error.
> >
> > Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> > ---
> >  drivers/tty/serial/sprd_serial.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
> > index 9f8c14ff6454..54477de9822f 100644
> > --- a/drivers/tty/serial/sprd_serial.c
> > +++ b/drivers/tty/serial/sprd_serial.c
> > @@ -1204,8 +1204,10 @@ static int sprd_probe(struct platform_device *pdev)
> >         up->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SPRD_CONSOLE);
> >
> >         ret = sprd_clk_init(up);
> > -       if (ret)
> > +       if (ret) {
> > +               sprd_port[index] = NULL;
>
> 如果我们强制使用alias, 则这里应该也无需清除了,因为一进probe就会给它重新赋值。 还是我漏了什么?

是不需要, 所以我comment message里写的是it would be better...

我觉得是下面返回的地方都清理了, 这里也清理掉

要么都去掉?


>
>
> >                 return ret;
> > +       }
> >
> >         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >         up->membase = devm_ioremap_resource(&pdev->dev, res);
> > --
> > 2.20.1
> >
>
>
> --
> Baolin Wang

  reply	other threads:[~2020-03-18  9:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18  8:31 [PATCH v2 1/2] serial: sprd: getting port index via serial alias only Chunyan Zhang
2020-03-18  8:31 ` [PATCH v2 2/2] serial: sprd: cleanup the sprd_port for error case Chunyan Zhang
2020-03-18  9:16   ` Baolin Wang
2020-03-18  9:47     ` Chunyan Zhang [this message]
2020-03-18  9:54       ` Baolin Wang
2020-03-18 10:06     ` Baolin Wang
2020-03-18 10:13       ` Greg Kroah-Hartman
2020-03-18 10:16         ` Chunyan Zhang
2020-03-18 10:46           ` Greg Kroah-Hartman
2020-03-18 11:01             ` Chunyan Zhang

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=CAAfSe-u-ui3SP8vnNPMuKHhB-iMCscc4OE16hoDWZ8xzsie+vQ@mail.gmail.com \
    --to=zhang.lyra@gmail.com \
    --cc=baolin.wang7@gmail.com \
    --cc=chunyan.zhang@unisoc.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=orsonzhai@gmail.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).