diff mbox

[1/3] drm/xen-front: checking for NULL instead of IS_ERR

Message ID 20180508092650.GA661@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter May 8, 2018, 9:26 a.m. UTC
drm_dev_alloc() returns error pointers, it never returns NULL.

Fixes: c575b7eeb89f ("drm/xen-front: Add support for Xen PV display frontend")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Oleksandr Andrushchenko May 8, 2018, 9:34 a.m. UTC | #1
On 05/08/2018 12:26 PM, Dan Carpenter wrote:
> drm_dev_alloc() returns error pointers, it never returns NULL.
>
> Fixes: c575b7eeb89f ("drm/xen-front: Add support for Xen PV display frontend")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thank you,
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
> index 1b0ea9ac330e..8615e8522c7a 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -543,8 +543,8 @@ static int xen_drm_drv_init(struct xen_drm_front_info *front_info)
>   	front_info->drm_info = drm_info;
>   
>   	drm_dev = drm_dev_alloc(&xen_drm_driver, dev);
> -	if (!drm_dev) {
> -		ret = -ENOMEM;
> +	if (IS_ERR(drm_dev)) {
> +		ret = PTR_ERR(drm_dev);
>   		goto fail;
>   	}
>   
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Oleksandr Andrushchenko May 8, 2018, 11:50 a.m. UTC | #2
On 05/08/2018 12:34 PM, Oleksandr Andrushchenko wrote:
> On 05/08/2018 12:26 PM, Dan Carpenter wrote:
>> drm_dev_alloc() returns error pointers, it never returns NULL.
>>
>> Fixes: c575b7eeb89f ("drm/xen-front: Add support for Xen PV display 
>> frontend")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Thank you,
> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Applied to drm-misc-next,
Thank you
>>
>> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c 
>> b/drivers/gpu/drm/xen/xen_drm_front.c
>> index 1b0ea9ac330e..8615e8522c7a 100644
>> --- a/drivers/gpu/drm/xen/xen_drm_front.c
>> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
>> @@ -543,8 +543,8 @@ static int xen_drm_drv_init(struct 
>> xen_drm_front_info *front_info)
>>       front_info->drm_info = drm_info;
>>         drm_dev = drm_dev_alloc(&xen_drm_driver, dev);
>> -    if (!drm_dev) {
>> -        ret = -ENOMEM;
>> +    if (IS_ERR(drm_dev)) {
>> +        ret = PTR_ERR(drm_dev);
>>           goto fail;
>>       }
>>   _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
index 1b0ea9ac330e..8615e8522c7a 100644
--- a/drivers/gpu/drm/xen/xen_drm_front.c
+++ b/drivers/gpu/drm/xen/xen_drm_front.c
@@ -543,8 +543,8 @@  static int xen_drm_drv_init(struct xen_drm_front_info *front_info)
 	front_info->drm_info = drm_info;
 
 	drm_dev = drm_dev_alloc(&xen_drm_driver, dev);
-	if (!drm_dev) {
-		ret = -ENOMEM;
+	if (IS_ERR(drm_dev)) {
+		ret = PTR_ERR(drm_dev);
 		goto fail;
 	}