Message ID | 21a4b368b49aaa46e9d78cccd855bb11b49ab39c.1729074076.git.mchehab+huawei@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Media: fix several issues on drivers | expand |
On 16/10/2024 12:22, Mauro Carvalho Chehab wrote: > 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. > > Use instead -ENOENT to indicate that the tag was not found. > > Fixes: 056f2821b631 ("media: cec: extron-da-hd-4k-plus: add the Extron DA HD 4K Plus CEC driver") Not a fix, since it isn't broken. It is returning an offset, and -1 is used if it isn't found. It's fine to change it to -ENOENT since the code calling it just checks if the result > 0. So it is a slight improvement of the code, but not a fix. > Cc: stable@vger.kernel.org So this isn't needed either. Regards, Hans > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> > --- > .../cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c > index a526464af88c..7d03a36df5cf 100644 > --- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c > +++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c > @@ -348,12 +348,12 @@ static int get_edid_tag_location(const u8 *edid, unsigned int size, > > /* Return if not a CTA-861 extension block */ > if (size < 256 || edid[0] != 0x02 || edid[1] != 0x03) > - return -1; > + return -ENOENT; > > /* search tag */ > d = edid[0x02] & 0x7f; > if (d <= 4) > - return -1; > + return -ENOENT; > > i = 0x04; > end = 0x00 + d; > @@ -371,7 +371,7 @@ static int get_edid_tag_location(const u8 *edid, unsigned int size, > return offset + i; > i += len + 1; > } while (i < end); > - return -1; > + return -ENOENT; > } > > static void extron_edid_crc(u8 *edid)
diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c index a526464af88c..7d03a36df5cf 100644 --- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c +++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c @@ -348,12 +348,12 @@ static int get_edid_tag_location(const u8 *edid, unsigned int size, /* Return if not a CTA-861 extension block */ if (size < 256 || edid[0] != 0x02 || edid[1] != 0x03) - return -1; + return -ENOENT; /* search tag */ d = edid[0x02] & 0x7f; if (d <= 4) - return -1; + return -ENOENT; i = 0x04; end = 0x00 + d; @@ -371,7 +371,7 @@ static int get_edid_tag_location(const u8 *edid, unsigned int size, return offset + i; i += len + 1; } while (i < end); - return -1; + return -ENOENT; } static void extron_edid_crc(u8 *edid)
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. Use instead -ENOENT to indicate that the tag was not found. Fixes: 056f2821b631 ("media: cec: extron-da-hd-4k-plus: add the Extron DA HD 4K Plus CEC driver") Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> --- .../cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)