lkml.org 
[lkml]   [2020]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 2/2] serial: sprd: cleanup the sprd_port for error case
On Wed, Mar 18, 2020 at 5:16 PM 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就会给它重新赋值。 还是我漏了什么?

Sorry, please ignore my previsous comment. I made a stupid mistake
when talking with Chunyan.

So what I mean is we should not add this clean up, cause we will
always get the correct index with aliases, and it will be overlapped
when probing again.

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

\
 
 \ /
  Last update: 2020-03-18 11:06    [W:0.066 / U:8.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site