static inline bool fmt_is_valid_color(u32 format)
{
- if (format > ARRAY_SIZE(color_formats_table))
+ if (format >= ARRAY_SIZE(color_formats_table))
return false;
if (color_formats_table[format].valid_color)
static inline bool fmt_is_valid_texture(u32 format)
{
- if (format > ARRAY_SIZE(color_formats_table))
+ if (format >= ARRAY_SIZE(color_formats_table))
return false;
if (color_formats_table[format].blockwidth > 0)
static inline int fmt_get_blocksize(u32 format)
{
- if (format > ARRAY_SIZE(color_formats_table))
+ if (format >= ARRAY_SIZE(color_formats_table))
return 0;
return color_formats_table[format].blocksize;
static inline int fmt_get_nblocksx(u32 format, u32 w)
{
unsigned bw;
- if (format > ARRAY_SIZE(color_formats_table))
+
+ if (format >= ARRAY_SIZE(color_formats_table))
return 0;
bw = color_formats_table[format].blockwidth;
static inline int fmt_get_nblocksy(u32 format, u32 h)
{
unsigned bh;
- if (format > ARRAY_SIZE(color_formats_table))
+
+ if (format >= ARRAY_SIZE(color_formats_table))
return 0;
bh = color_formats_table[format].blockheight;
static inline int r600_bpe_from_format(u32 *bpe, u32 format)
{
unsigned res;
- if (format > ARRAY_SIZE(color_formats_table))
+
+ if (format >= ARRAY_SIZE(color_formats_table))
goto fail;
res = color_formats_table[format].blocksize;