diff mbox series

drm/vboxvideo: fix a NULL vs IS_ERR() check

Message ID 20211118111233.GA1147@kili (mailing list archive)
State New, archived
Headers show
Series drm/vboxvideo: fix a NULL vs IS_ERR() check | expand

Commit Message

Dan Carpenter Nov. 18, 2021, 11:12 a.m. UTC
The devm_gen_pool_create() function never returns NULL, it returns
error pointers.

Fixes: 4cc9b565454b ("drm/vboxvideo: Use devm_gen_pool_create")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Hans de Goede Nov. 18, 2021, 11:46 a.m. UTC | #1
Hi,

On 11/18/21 12:12, Dan Carpenter wrote:
> The devm_gen_pool_create() function never returns NULL, it returns
> error pointers.
> 
> Fixes: 4cc9b565454b ("drm/vboxvideo: Use devm_gen_pool_create")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

I will go and push this to drm-misc-next right away.

Regards,

Hans

> ---
>  drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c
> index f28779715ccd..c9e8b3a63c62 100644
> --- a/drivers/gpu/drm/vboxvideo/vbox_main.c
> +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c
> @@ -127,8 +127,8 @@ int vbox_hw_init(struct vbox_private *vbox)
>  	/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
>  	vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1,
>  						"vboxvideo-accel");
> -	if (!vbox->guest_pool)
> -		return -ENOMEM;
> +	if (IS_ERR(vbox->guest_pool))
> +		return PTR_ERR(vbox->guest_pool);
>  
>  	ret = gen_pool_add_virt(vbox->guest_pool,
>  				(unsigned long)vbox->guest_heap,
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c
index f28779715ccd..c9e8b3a63c62 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_main.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_main.c
@@ -127,8 +127,8 @@  int vbox_hw_init(struct vbox_private *vbox)
 	/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
 	vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1,
 						"vboxvideo-accel");
-	if (!vbox->guest_pool)
-		return -ENOMEM;
+	if (IS_ERR(vbox->guest_pool))
+		return PTR_ERR(vbox->guest_pool);
 
 	ret = gen_pool_add_virt(vbox->guest_pool,
 				(unsigned long)vbox->guest_heap,