RE: RE: [PATCH v2] usb: core:hub.c: do not print error log on -enomem
From: Atul Raj
Date: Wed Nov 30 2016 - 06:40:49 EST
changes in v2
- added braces as suggested.
drivers/usb/core/hub.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 749d595..82059f26 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -816,9 +816,10 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
* there can be many TTs per hub). even if they're uncommon.
*/
clear = kmalloc(sizeof *clear, GFP_ATOMIC);
- if (clear == NULL)
+ if (clear == NULL) {
/* FIXME recover somehow ... RESET_TT? */
return -ENOMEM;
+ }
/* info that CLEAR_TT_BUFFER needs */
clear->tt = tt->multi ? udev->ttport : 1;
--
2.10.2.windows.1
> s/enomem/ENOMEM
>
> On 30-11-16, 06:32, Atul Raj wrote:
> > All kmalloc-based functions print enough information on failures.
> >
> > Signed-off-by: Atul Raj <atul.r@xxxxxxxxxxx>
> > ---
> > drivers/usb/core/hub.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index cbb1467..749d595 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -816,11 +816,9 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
> > * there can be many TTs per hub). even if they're uncommon.
> > */
> > clear = kmalloc(sizeof *clear, GFP_ATOMIC);
> > - if (clear == NULL) {
> > - dev_err(&udev->dev, "can't save CLEAR_TT_BUFFER state\n");
> > + if (clear == NULL)
> > /* FIXME recover somehow ... RESET_TT? */
> > return -ENOMEM;
>
> It is still preferred to keep {} here as comment also takes a line.
>
> > - }
> >
> > /* info that CLEAR_TT_BUFFER needs */
> > clear->tt = tt->multi ? udev->ttport : 1;
> > --
> > 2.10.2.windows.1
>
>
> --
> viresh
>
>