[PATCH] staging: media: av7110: fix error code in frontend_init()

Tomasz Unger posted 1 patch 3 weeks, 3 days ago
drivers/staging/media/av7110/av7110.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] staging: media: av7110: fix error code in frontend_init()
Posted by Tomasz Unger 3 weeks, 3 days ago
Return -ENODEV instead of -ENOMEM when no frontend driver is found
for the device. -ENODEV is semantically correct here as the failure
is due to no matching frontend driver being found, not a memory
allocation failure.

Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
---
 drivers/staging/media/av7110/av7110.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/media/av7110/av7110.c b/drivers/staging/media/av7110/av7110.c
index 607992100baf..7323f550fb72 100644
--- a/drivers/staging/media/av7110/av7110.c
+++ b/drivers/staging/media/av7110/av7110.c
@@ -2237,8 +2237,7 @@ static int frontend_init(struct av7110 *av7110)
 	}
 
 	if (!av7110->fe) {
-		/* FIXME: propagate the failure code from the lower layers */
-		ret = -ENOMEM;
+		ret = -ENODEV;
 		pr_err("A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
 		       av7110->dev->pci->vendor, av7110->dev->pci->device,
 		       av7110->dev->pci->subsystem_vendor, av7110->dev->pci->subsystem_device);

---
base-commit: 711ca05c484c6c13582fcf2880a62a3ffdcb6eac
change-id: 20260313-av7110-fix-enodev-fd21468f47f4

Best regards,
-- 
Tomasz Unger <tomasz.unger@yahoo.pl>
Re: [PATCH] staging: media: av7110: fix error code in frontend_init()
Posted by Dan Carpenter 3 weeks ago
On Fri, Mar 13, 2026 at 06:36:52PM +0100, Tomasz Unger wrote:
> Return -ENODEV instead of -ENOMEM when no frontend driver is found
> for the device. -ENODEV is semantically correct here as the failure
> is due to no matching frontend driver being found, not a memory
> allocation failure.
> 
> Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
> ---

Returning -ENOMEM is just as reasonable as -ENODEV.  We're looking at
if ves1820_attach(), ves1x93_attach() or stv0299_attach() etc fail.
Memory allocation failures seem like the most common cause to me.

The FIXME also seems reasonable...  Just leave it as-is until someone
can address it properly.

regards,
dan carpenter