Skip to content

Commit eba6a86

Browse files
committed
media: cec: extron-da-hd-4k-plus: don't use -1 as an error code
The logic at get_edid_tag_location() returns either an offset or an error condition. However, the error condition uses a non-standard "-1" value. This hits a Coverity bug, as Coverity assumes that positive values are underflow. While this is a false positive, returning error codes as -1 is an issue. So, instead, use -ENOENT to indicate that the tag was not found. Fixes: 056f282 ("media: cec: extron-da-hd-4k-plus: add the Extron DA HD 4K Plus CEC driver") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 2d86197 commit eba6a86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,12 @@ static int get_edid_tag_location(const u8 *edid, unsigned int size,
348348

349349
/* Return if not a CTA-861 extension block */
350350
if (size < 256 || edid[0] != 0x02 || edid[1] != 0x03)
351-
return -1;
351+
return -ENOENT;
352352

353353
/* search tag */
354354
d = edid[0x02] & 0x7f;
355355
if (d <= 4)
356-
return -1;
356+
return -ENOENT;
357357

358358
i = 0x04;
359359
end = 0x00 + d;
@@ -371,7 +371,7 @@ static int get_edid_tag_location(const u8 *edid, unsigned int size,
371371
return offset + i;
372372
i += len + 1;
373373
} while (i < end);
374-
return -1;
374+
return -ENOENT;
375375
}
376376

377377
static void extron_edid_crc(u8 *edid)

0 commit comments

Comments
 (0)