>-----Original Message-----
>From: [email protected] 
>[mailto:[email protected]] On Behalf Of
>Pandita, Vikram
>>From: [email protected] 
>>[mailto:[email protected]] On Behalf Of Gupta,
>>Ajay Kumar
>>Sent: Sunday, November 15, 2009 2:46 AM
>>To: [email protected]
>>Cc: [email protected]; [email protected]; Gupta, Ajay 
>>Kumar
>>Subject: [PATCH] omap3: ehci: Add regulator framework
><snip>
>>+     /* get ehci regulator and enable */
>>+     for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) {
>>+             if (omap->port_mode[i] != EHCI_HCD_OMAP_MODE_PHY) {
>>+                     omap->regulator[i] = NULL;
>>+                     continue;
>>+             }
>>+             snprintf(supply, sizeof(supply), "hsusb%d", i);
>
>supply[] being auto variable, is it guaranteed to be null terminated?
>Suggestion:
>               n = snprintf(supply, sizeof(supply), "hsusb%d", i);
>               supply[n] = '\0';

Setting null is redundant as snprintf() does that internally too.

Can see snprinf calls vsnprintf and:
vsnprintf( ... ) 
...
       if (size > 0) {
                if (str < end)
>>>>                        *str = '\0';
                else
                        end[-1] = '\0';
        }
...
So I guess this is a noisy review comment :) and please ignore.
Patch looks good.

>
>>+             omap->regulator[i] = regulator_get(omap->dev, supply);
>>+             if (IS_ERR(omap->regulator[i]))
>>+                     dev_dbg(&pdev->dev,
>>+                     "failed to get ehci port%d regulator\n", i);
>>+             else
>>+                     regulator_enable(omap->regulator[i]);
>>+     }
>>+
><snip>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>the body of a message to [email protected]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to