diff mbox series

drm/i915/gvt: IS_ERR() vs NULL bug in intel_gvt_update_reg_whitelist()

Message ID Ysftoia2BPUyqVcD@kili (mailing list archive)
State New, archived
Headers show
Series drm/i915/gvt: IS_ERR() vs NULL bug in intel_gvt_update_reg_whitelist() | expand

Commit Message

Dan Carpenter July 8, 2022, 8:41 a.m. UTC
The shmem_pin_map() function returns NULL, it doesn't return error
pointers.

Fixes: 97ea656521c8 ("drm/i915/gvt: Parse default state to update reg whitelist")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andrzej Hajda July 8, 2022, 8:55 a.m. UTC | #1
On 08.07.2022 10:41, Dan Carpenter wrote:
> The shmem_pin_map() function returns NULL, it doesn't return error
> pointers.
> 
> Fixes: 97ea656521c8 ("drm/i915/gvt: Parse default state to update reg whitelist")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> index b9eb75a2b400..1c35a41620ae 100644
> --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> @@ -3117,9 +3117,9 @@ void intel_gvt_update_reg_whitelist(struct intel_vgpu *vgpu)
>   			continue;
>   
>   		vaddr = shmem_pin_map(engine->default_state);
> -		if (IS_ERR(vaddr)) {
> -			gvt_err("failed to map %s->default state, err:%zd\n",
> -				engine->name, PTR_ERR(vaddr));
> +		if (!vaddr) {
> +			gvt_err("failed to map %s->default state\n",
> +				engine->name);
>   			return;
>   		}
>
Zhenyu Wang July 11, 2022, 2:58 a.m. UTC | #2
On 2022.07.08 10:55:52 +0200, Andrzej Hajda wrote:
> On 08.07.2022 10:41, Dan Carpenter wrote:
> > The shmem_pin_map() function returns NULL, it doesn't return error
> > pointers.
> > 
> > Fixes: 97ea656521c8 ("drm/i915/gvt: Parse default state to update reg whitelist")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
> 

Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>

Thanks! Will push to -fixes.

> 
> > ---
> >   drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> > index b9eb75a2b400..1c35a41620ae 100644
> > --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> > +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> > @@ -3117,9 +3117,9 @@ void intel_gvt_update_reg_whitelist(struct intel_vgpu *vgpu)
> >   			continue;
> >   		vaddr = shmem_pin_map(engine->default_state);
> > -		if (IS_ERR(vaddr)) {
> > -			gvt_err("failed to map %s->default state, err:%zd\n",
> > -				engine->name, PTR_ERR(vaddr));
> > +		if (!vaddr) {
> > +			gvt_err("failed to map %s->default state\n",
> > +				engine->name);
> >   			return;
> >   		}
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index b9eb75a2b400..1c35a41620ae 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
@@ -3117,9 +3117,9 @@  void intel_gvt_update_reg_whitelist(struct intel_vgpu *vgpu)
 			continue;
 
 		vaddr = shmem_pin_map(engine->default_state);
-		if (IS_ERR(vaddr)) {
-			gvt_err("failed to map %s->default state, err:%zd\n",
-				engine->name, PTR_ERR(vaddr));
+		if (!vaddr) {
+			gvt_err("failed to map %s->default state\n",
+				engine->name);
 			return;
 		}