Re: [PATCH 3/4] msm_serial: Make baud_code detection more dynamic

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

 



On Wed, Jul 24, 2013 at 10:37 AM, Stephen Boyd <sboyd@xxxxxxxxxxxxxx> wrote:
> [snip]
> +       unsigned int i, divisor;
> +       const struct msm_baud_map *entry;
> +       static const struct msm_baud_map table[] = {
> +               { 1536, 0x00,  1 },
> +               {  768, 0x11,  1 },
> +               {  384, 0x22,  1 },
> +               {  192, 0x33,  1 },
> +               {   96, 0x44,  1 },
> +               {   48, 0x55,  1 },
> +               {   32, 0x66,  1 },
> +               {   24, 0x77,  1 },
> +               {   16, 0x88,  1 },
> +               {   12, 0x99,  6 },
> +               {    8, 0xaa,  6 },
> +               {    6, 0xbb,  6 },
> +               {    4, 0xcc,  6 },
> +               {    3, 0xdd,  8 },
> +               {    2, 0xee, 16 },
> +               {    1, 0xff, 31 },
> +       };
> +
> +       divisor = uart_get_divisor(port, baud);
> +
> +       for (i = 0, entry = table; i < ARRAY_SIZE(table); i++, entry++)
> +               if (entry->divisor <= divisor)
> +                       break;
> +
> +       return entry; /* Default to smallest divider */

Shouldn't matter, but you're not defaulting to the smallest divider.
Your are defaulting to an undefined value, as `entry` will be off the
array once i == ARRAY_SIZE().

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux