Re: [PATCH RFC v3 5/9] staging: most: usb: check for NULL device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 15, 2020 at 03:32:48PM +0000, Christian.Gromm@xxxxxxxxxxxxx wrote:
> On Wed, 2020-01-15 at 13:18 +0100, Greg KH wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > know the content is safe
> > 
> > On Tue, Jan 14, 2020 at 04:57:54PM +0100, Christian Gromm wrote:
> > > Check if the dci structer has been allocated before trying to
> > > release it.
> > > 
> > > Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
> > > ---
> > > v3:
> > >       This patch has been added to the series.
> > > 
> > >  drivers/staging/most/usb/usb.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/most/usb/usb.c
> > > b/drivers/staging/most/usb/usb.c
> > > index fe3384a..cae7553 100644
> > > --- a/drivers/staging/most/usb/usb.c
> > > +++ b/drivers/staging/most/usb/usb.c
> > > @@ -1205,8 +1205,10 @@ static void hdm_disconnect(struct
> > > usb_interface *interface)
> > >       del_timer_sync(&mdev->link_stat_timer);
> > >       cancel_work_sync(&mdev->poll_work_obj);
> > > 
> > > -     most_put_iface_dev(mdev->dci->dev.parent);
> > > -     device_unregister(&mdev->dci->dev);
> > > +     if (mdev->dci) {
> > > +             most_put_iface_dev(mdev->dci->dev.parent);
> > > +             device_unregister(&mdev->dci->dev);
> > > +     }
> > 
> > How can this happen?
> 
> Depending on the Vendor/Product ID pair of the device that
> probes the USB driver, this 'dci' structure is being allocated
> and registered or not. And that is why this check is necessary. 
> 
> > 
> > And why is it up to the child function here to unregister the device,
> 
> Child function? The device is being registered in the probe function
> and unregistered in the disconnect function. What is wrong here?

Ah, ok, I got confused here with the previous patch, sorry.

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux