RE: [PATCH] omap3: ehci: Add regulator framework

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

 



>-----Original Message-----
>From: linux-omap-owner@xxxxxxxxxxxxxxx [mailto:linux-omap-owner@xxxxxxxxxxxxxxx] On Behalf Of
>Pandita, Vikram
>>From: linux-omap-owner@xxxxxxxxxxxxxxx [mailto:linux-omap-owner@xxxxxxxxxxxxxxx] On Behalf Of Gupta,
>>Ajay Kumar
>>Sent: Sunday, November 15, 2009 2:46 AM
>>To: linux-omap@xxxxxxxxxxxxxxx
>>Cc: felipe.balbi@xxxxxxxxx; broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx; 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 majordomo@xxxxxxxxxxxxxxx
>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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux