Re: [PATCH] v4l: of: check for unique lanes in data-lanes and clock-lanes

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

 



Hi Niklas,

On Thu, Jan 26, 2017 at 2:12 PM, Niklas Söderlund
<niklas.soderlund+renesas@xxxxxxxxxxxx> wrote:
> diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c
> index 93b33681776c..1042db6bb996 100644
> --- a/drivers/media/v4l2-core/v4l2-of.c
> +++ b/drivers/media/v4l2-core/v4l2-of.c
> @@ -32,12 +32,19 @@ static int v4l2_of_parse_csi_bus(const struct device_node *node,
>         prop = of_find_property(node, "data-lanes", NULL);
>         if (prop) {
>                 const __be32 *lane = NULL;
> -               unsigned int i;
> +               unsigned int i, n;

Not "j"?

>                 for (i = 0; i < ARRAY_SIZE(bus->data_lanes); i++) {
>                         lane = of_prop_next_u32(prop, lane, &v);
>                         if (!lane)
>                                 break;
> +                       for (n = 0; n < i; n++) {

I'm not used seeing for loops with an index named "n", and limit named "i" ;-)

> +                               if (bus->data_lanes[n] == v) {
> +                                       pr_warn("%s: duplicated lane %u in data-lanes\n",
> +                                               node->full_name, v);
> +                                       return -EINVAL;
> +                               }
> +                       }
>                         bus->data_lanes[i] = v;
>                 }
>                 bus->num_data_lanes = i;
> @@ -63,6 +70,15 @@ static int v4l2_of_parse_csi_bus(const struct device_node *node,
>         }
>
>         if (!of_property_read_u32(node, "clock-lanes", &v)) {
> +               unsigned int n;

Likewise.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux