[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62666ecc6ac9c5217cf5e376424e512a511791fe@linux.dev>
Date: Thu, 17 Jul 2025 00:04:56 +0000
From: qiang.zhang@...ux.dev
To: "Simon Horman" <horms@...nel.org>
Cc: oneukum@...e.com, kuba@...nel.org, andrew+netdev@...n.ch,
davem@...emloft.net, pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: usb: Make init_satus() return -ENOMEM if alloc
failed
>
> On Wed, Jul 16, 2025 at 08:15:23AM +0800, Zqiang wrote:
>
> >
> > This commit make init_status() return -ENOMEM, if invoke
> >
> > kmalloc() return failed.
> >
> >
> >
> > Signed-off-by: Zqiang <qiang.zhang@...ux.dev>
> >
>
> Hi,
>
> It seems to me that the code has been structured so that
>
> this case is not treated as an error, and rather initialisation
>
> that depends on it is skipped.
Yes, your point is also correct, but in theory,
if usb_alloc_urb() allocation fails, we should
also return a value of 0, should we keep the
two behaviors consistent?
>
> Are you sure this change is correct?
For drivers that have a driver_info->status method, it is generally
needto allocate an interrupt urb and fill it to obtain some
status information, but if kmalloc() faild and return 0 in init_status(),
and some dirvers directly call usbnet_status_start(),
the WARN_ONCE(dev->interrupt == NULL) will be trigger.
Thanks
Zqiang
>
Powered by blists - more mailing lists