Re: [PATCH 1/6] tty: n_gsm: Add support for serdev drivers
From: Tony Lindgren
Date: Fri May 01 2020 - 17:31:16 EST
* Pavel Machek <pavel@xxxxxxx> [200501 20:32]:
> > +static struct gsm_dlci *gsd_dlci_get(struct gsm_serdev *gsd, int line,
> > + bool allocate)
> > +{
> > + struct gsm_mux *gsm;
> > + struct gsm_dlci *dlci;
> > +
> > + if (!gsd || !gsd->gsm)
> > + return ERR_PTR(-ENODEV);
> > +
> > + gsm = gsd->gsm;
> > +
> > + if (line < 1 || line >= 63)
> > + return ERR_PTR(-EINVAL);
> > +
> > + mutex_lock(&gsm->mutex);
> ...
> > + dlci = gsm_dlci_alloc(gsm, line);
> > + if (!dlci) {
> > + gsm = ERR_PTR(-ENOMEM);
> > + goto unlock;
>
> dlci = , or you get nice crash.
Ah thanks yeah we return dlci and need to set dlci instead:
if (!dlci) {
dlci = ERR_PTR(-ENOMEM);
goto unlock;
}
Regards,
Tony