lkml.org 
[lkml]   [2023]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] usb: gadget: u_serial: Add null pointer check in gserial_resume
From


> And this seems like a viable option to me, what do you suggest?
>
> gserial_disconnect {
>     spin_lock(static)
>     spin_lock(port)
>     ...
>     gser->ioport = NULL;
>     ...
>     spin_lock(port)
>     spin_unlock(static)
>
> }
>
> gserial_resume {
>     struct gs_port *port = gser->ioport;
>
>     spin_lock(static)
>     if (!port)
spin_unlock(static)
>         return
>     spin_lock(port)
>
>     ...
>     spin_unlock(port)
>     spin_unlock(static)
> }
>
> Thanks,
> Prashanth K
Small correction inlined.

\
 
 \ /
  Last update: 2023-03-27 00:17    [W:0.084 / U:3.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site