On Thu, Sep 16, 2010 at 23:46,  <[email protected]> wrote:
> Revision 9145 Author lliubbo Date 2010-09-16 23:46:22 -0400 (Thu, 16 Sep
> 2010)
>
> Log Message
>
> [#5553] spi_bfin5xx: fix bits_per_word check
>
> If a spi_transfer has a bits_per_word isn't (8,16),it will be treated as 16
> by
> mistake.
> This commit fix it with more check and reject that transfer with a err msg.
>
> Modified: trunk/drivers/spi/spi_bfin5xx.c (9144 => 9145)
>
>               drv_data->len = transfer->len;
>               cr_width = 0;
>               drv_data->ops = &bfin_transfer_ops_u8;
> -     } else {
> +     } else if (bits_per_word == 16) {
>               drv_data->n_bytes = 2;
>               drv_data->len = (transfer->len) >> 1;
>               cr_width = BIT_CTL_WORDSIZE;
>               drv_data->ops = &bfin_transfer_ops_u16;
> +     } else {
> +             dev_err(&drv_data->pdev->dev, "transfer: unsupported 
> bits_per_word\n");
> +             return;
>       }

reviewing this again, i noticed another issue ... this would
incorrectly reject GPIO CS transfers which are multiples of 8 bits.

check out the setup func to see how the bits_per_word field there is validated.
-mike
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to