Skip to contentSkip to conversation

media: au0828: fix a NULL vs IS_ERR() check

PATCH New Dan Carpenter 1 participant 1 message May 14, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: au0828: fix a NULL vs IS_ERR() check

The media_device_usb_allocate() function returns error pointers when it's enabled and something goes wrong. It can return NULL as well, but only if CONFIG_MEDIA_CONTROLLER is disabled so that doesn't apply here.

Fixes 812658d88d26 ("media: change au0828 to use Media Device Allocator API")
---
 drivers/media/usb/au0828/au0828-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/au0828/au0828-core.c +2 -2
index a8a72d5fbd12..caefac07af92 100644
@@ -199,8 +199,8 @@ static int au0828_media_device_init(struct au0828_dev *dev,
 	struct media_device *mdev;
 
 	mdev = media_device_usb_allocate(udev, KBUILD_MODNAME, THIS_MODULE);
-	if (!mdev)
-		return -ENOMEM;
+	if (IS_ERR(mdev))
+		return PTR_ERR(mdev);
 
 	dev->media_dev = mdev;
 #endif
Signature · 1 line
2.30.2