On Tue, 10 Dec 2024 13:53:20 +0800
Junlong Wang <wang.junlo...@zte.com.cn> wrote:

> +static uint32_t
> +zxdh_np_comm_read_bits(uint8_t *p_base, uint32_t base_size_bit,
> +             uint32_t *p_data, uint32_t start_bit, uint32_t end_bit)
> +{
> +     uint32_t   len               =  0;
> +     uint32_t   start_byte_index  =  0;
> +     uint32_t   end_byte_index    =  0;
> +     uint32_t   byte_num          =  0;
> +     uint32_t   buffer_size       =  0;
> +
> +     if (0 != (base_size_bit % 8))
> +             return 1;
> +
> +     if (start_bit > end_bit)
> +             return 1;
> +
> +     if (base_size_bit < end_bit)
> +             return 1;
> +
> +     len = end_bit - start_bit + 1;

Another case of the "initialize everything" style.
len is set to zero when declared then first use assigns it.

Reply via email to