RE: [PATCH v2] usb: core:hub.c: do not print error log on -enomem

Submitted by Atul Raj on Nov. 30, 2016, 11:40 a.m.

Details

Message ID 20161130114028epcms5p8f4d171c212743cb3c9644869beb85fe2@epcms5p8
State New
Headers show
Series "usb:hub: readibility and consistency in coding style" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Atul Raj Nov. 30, 2016, 11:40 a.m.
changes in v2
        - added braces as suggested.

 drivers/usb/core/hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
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@samsung.com>

 > > ---

 > >  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

 >  

 >

Patch hide | download patch | download mbox

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;