* [PATCH 2/3] drm/xen-front: fix xen_drm_front_shbuf_alloc() error handling
@ 2018-05-08 9:27 Dan Carpenter
2018-05-08 9:37 ` Oleksandr Andrushchenko
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2018-05-08 9:27 UTC (permalink / raw)
To: Oleksandr Andrushchenko
Cc: David Airlie, kernel-janitors, dri-devel, xen-devel
The xen_drm_front_shbuf_alloc() function was returning a mix of error
pointers and NULL and the the caller wasn't checking correctly. I've
changed it to always return error pointer consistently.
Fixes: c575b7eeb89f ("drm/xen-front: Add support for Xen PV display frontend")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/xen/xen_drm_front_shbuf.c b/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
index d5705251a0d6..8099cb343ae3 100644
--- a/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
+++ b/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
@@ -383,7 +383,7 @@ xen_drm_front_shbuf_alloc(struct xen_drm_front_shbuf_cfg *cfg)
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
if (!buf)
- return NULL;
+ return ERR_PTR(-ENOMEM);
if (cfg->be_alloc)
buf->ops = &backend_ops;
diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
index 8615e8522c7a..378cb7ce0db5 100644
--- a/drivers/gpu/drm/xen/xen_drm_front.c
+++ b/drivers/gpu/drm/xen/xen_drm_front.c
@@ -188,8 +188,8 @@ int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info,
buf_cfg.be_alloc = front_info->cfg.be_alloc;
shbuf = xen_drm_front_shbuf_alloc(&buf_cfg);
- if (!shbuf)
- return -ENOMEM;
+ if (IS_ERR(shbuf))
+ return PTR_ERR(shbuf);
ret = dbuf_add_to_list(front_info, shbuf, dbuf_cookie);
if (ret < 0) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] drm/xen-front: fix xen_drm_front_shbuf_alloc() error handling
2018-05-08 9:27 [PATCH 2/3] drm/xen-front: fix xen_drm_front_shbuf_alloc() error handling Dan Carpenter
@ 2018-05-08 9:37 ` Oleksandr Andrushchenko
2018-05-08 11:50 ` Oleksandr Andrushchenko
0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Andrushchenko @ 2018-05-08 9:37 UTC (permalink / raw)
To: Dan Carpenter, Oleksandr Andrushchenko
Cc: David Airlie, kernel-janitors, dri-devel, xen-devel
On 05/08/2018 12:27 PM, Dan Carpenter wrote:
> The xen_drm_front_shbuf_alloc() function was returning a mix of error
> pointers and NULL and the the caller wasn't checking correctly. I've
> changed it to always return error pointer consistently.
>
> 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_shbuf.c b/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
> index d5705251a0d6..8099cb343ae3 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
> @@ -383,7 +383,7 @@ xen_drm_front_shbuf_alloc(struct xen_drm_front_shbuf_cfg *cfg)
>
> buf = kzalloc(sizeof(*buf), GFP_KERNEL);
> if (!buf)
> - return NULL;
> + return ERR_PTR(-ENOMEM);
>
> if (cfg->be_alloc)
> buf->ops = &backend_ops;
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
> index 8615e8522c7a..378cb7ce0db5 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -188,8 +188,8 @@ int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info,
> buf_cfg.be_alloc = front_info->cfg.be_alloc;
>
> shbuf = xen_drm_front_shbuf_alloc(&buf_cfg);
> - if (!shbuf)
> - return -ENOMEM;
> + if (IS_ERR(shbuf))
> + return PTR_ERR(shbuf);
>
> ret = dbuf_add_to_list(front_info, shbuf, dbuf_cookie);
> if (ret < 0) {
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] drm/xen-front: fix xen_drm_front_shbuf_alloc() error handling
2018-05-08 9:37 ` Oleksandr Andrushchenko
@ 2018-05-08 11:50 ` Oleksandr Andrushchenko
0 siblings, 0 replies; 3+ messages in thread
From: Oleksandr Andrushchenko @ 2018-05-08 11:50 UTC (permalink / raw)
To: Dan Carpenter, Oleksandr Andrushchenko
Cc: David Airlie, kernel-janitors, dri-devel, xen-devel
On 05/08/2018 12:37 PM, Oleksandr Andrushchenko wrote:
> On 05/08/2018 12:27 PM, Dan Carpenter wrote:
>> The xen_drm_front_shbuf_alloc() function was returning a mix of error
>> pointers and NULL and the the caller wasn't checking correctly. I've
>> changed it to always return error pointer consistently.
>>
>> 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_shbuf.c
>> b/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
>> index d5705251a0d6..8099cb343ae3 100644
>> --- a/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
>> +++ b/drivers/gpu/drm/xen/xen_drm_front_shbuf.c
>> @@ -383,7 +383,7 @@ xen_drm_front_shbuf_alloc(struct
>> xen_drm_front_shbuf_cfg *cfg)
>> buf = kzalloc(sizeof(*buf), GFP_KERNEL);
>> if (!buf)
>> - return NULL;
>> + return ERR_PTR(-ENOMEM);
>> if (cfg->be_alloc)
>> buf->ops = &backend_ops;
>> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c
>> b/drivers/gpu/drm/xen/xen_drm_front.c
>> index 8615e8522c7a..378cb7ce0db5 100644
>> --- a/drivers/gpu/drm/xen/xen_drm_front.c
>> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
>> @@ -188,8 +188,8 @@ int xen_drm_front_dbuf_create(struct
>> xen_drm_front_info *front_info,
>> buf_cfg.be_alloc = front_info->cfg.be_alloc;
>> shbuf = xen_drm_front_shbuf_alloc(&buf_cfg);
>> - if (!shbuf)
>> - return -ENOMEM;
>> + if (IS_ERR(shbuf))
>> + return PTR_ERR(shbuf);
>> ret = dbuf_add_to_list(front_info, shbuf, dbuf_cookie);
>> if (ret < 0) {
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-08 11:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08 9:27 [PATCH 2/3] drm/xen-front: fix xen_drm_front_shbuf_alloc() error handling Dan Carpenter
2018-05-08 9:37 ` Oleksandr Andrushchenko
2018-05-08 11:50 ` Oleksandr Andrushchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).