[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADBw62pK6R2_voOMeShwzen2vUR_c4YS27r9xfXTwLD000p7ig@mail.gmail.com>
Date: Wed, 18 Mar 2020 17:54:24 +0800
From: Baolin Wang <baolin.wang7@...il.com>
To: Chunyan Zhang <zhang.lyra@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Orson Zhai <orsonzhai@...il.com>,
Chunyan Zhang <chunyan.zhang@...soc.com>
Subject: Re: [PATCH v2 2/2] serial: sprd: cleanup the sprd_port for error case
On Wed, Mar 18, 2020 at 5:48 PM Chunyan Zhang <zhang.lyra@...il.com> wrote:
>
> On Wed, 18 Mar 2020 at 17:16, Baolin Wang <baolin.wang7@...il.com> wrote:
> >
> > On Wed, Mar 18, 2020 at 4:31 PM Chunyan Zhang <zhang.lyra@...il.com> wrote:
> > >
> > > From: Chunyan Zhang <chunyan.zhang@...soc.com>
> > >
> > > It would be better to cleanup the sprd_port for the device before
> > > return error.
> > >
> > > Signed-off-by: Chunyan Zhang <chunyan.zhang@...soc.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
--
Baolin Wang
Powered by blists - more mailing lists