Skip to content

Commit

Permalink
media: au0828: fix a NULL vs IS_ERR() check
Browse files Browse the repository at this point in the history
[ Upstream commit 8f2e452 ]

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: 812658d ("media: change au0828 to use Media Device Allocator API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Jul 14, 2021
1 parent aff809a commit 2d2fee1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/usb/au0828/au0828-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d2fee1

Please sign in to comment.