[radeon-alex:drm-next-5.1-wip 212/267] drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1096 amdgpu_cs_process_fence_dep() error: 'fence' dereferencing possible ERR_PTR()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://people.freedesktop.org/~agd5f/linux.git drm-next-5.1-wip
head:   c05834c8acc8278f87203cf4ec2a513be3a6aa7d
commit: 67dd1a36334ffce82bebeb2d633e152aa436d370 [212/267] drm/amdgpu: Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES

smatch warnings:
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1096 amdgpu_cs_process_fence_dep() error: 'fence' dereferencing possible ERR_PTR()

git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git remote update radeon-alex
git checkout 67dd1a36334ffce82bebeb2d633e152aa436d370
vim +/fence +1096 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

d38ceaf99 Alex Deucher      2015-04-20  1062  
6f0308ebc Dave Airlie       2017-03-09  1063  static int amdgpu_cs_process_fence_dep(struct amdgpu_cs_parser *p,
6f0308ebc Dave Airlie       2017-03-09  1064  				       struct amdgpu_cs_chunk *chunk)
2b48d323b Christian König   2015-06-19  1065  {
76a1ea618 Christian König   2015-07-06  1066  	struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
2b48d323b Christian König   2015-06-19  1067  	unsigned num_deps;
6f0308ebc Dave Airlie       2017-03-09  1068  	int i, r;
6f0308ebc Dave Airlie       2017-03-09  1069  	struct drm_amdgpu_cs_chunk_dep *deps;
2b48d323b Christian König   2015-06-19  1070  
2b48d323b Christian König   2015-06-19  1071  	deps = (struct drm_amdgpu_cs_chunk_dep *)chunk->kdata;
2b48d323b Christian König   2015-06-19  1072  	num_deps = chunk->length_dw * 4 /
2b48d323b Christian König   2015-06-19  1073  		sizeof(struct drm_amdgpu_cs_chunk_dep);
2b48d323b Christian König   2015-06-19  1074  
6f0308ebc Dave Airlie       2017-03-09  1075  	for (i = 0; i < num_deps; ++i) {
76a1ea618 Christian König   2015-07-06  1076  		struct amdgpu_ctx *ctx;
0d346a14c Christian König   2018-07-19  1077  		struct drm_sched_entity *entity;
f54d18670 Chris Wilson      2016-10-25  1078  		struct dma_fence *fence;
2b48d323b Christian König   2015-06-19  1079  
6f0308ebc Dave Airlie       2017-03-09  1080  		ctx = amdgpu_ctx_get(fpriv, deps[i].ctx_id);
76a1ea618 Christian König   2015-07-06  1081  		if (ctx == NULL)
76a1ea618 Christian König   2015-07-06  1082  			return -EINVAL;
76a1ea618 Christian König   2015-07-06  1083  
0d346a14c Christian König   2018-07-19  1084  		r = amdgpu_ctx_get_entity(ctx, deps[i].ip_type,
6f0308ebc Dave Airlie       2017-03-09  1085  					  deps[i].ip_instance,
0d346a14c Christian König   2018-07-19  1086  					  deps[i].ring, &entity);
effd924d2 Andres Rodriguez  2017-02-16  1087  		if (r) {
effd924d2 Andres Rodriguez  2017-02-16  1088  			amdgpu_ctx_put(ctx);
effd924d2 Andres Rodriguez  2017-02-16  1089  			return r;
effd924d2 Andres Rodriguez  2017-02-16  1090  		}
effd924d2 Andres Rodriguez  2017-02-16  1091  
0d346a14c Christian König   2018-07-19  1092  		fence = amdgpu_ctx_get_fence(ctx, entity,
6f0308ebc Dave Airlie       2017-03-09  1093  					     deps[i].handle);
                                                        ^^^^^^^^

67dd1a363 Andrey Grodzovsky 2019-01-31  1094  
67dd1a363 Andrey Grodzovsky 2019-01-31  1095  		if (chunk->chunk_id == AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES) {
67dd1a363 Andrey Grodzovsky 2019-01-31 @1096  			struct drm_sched_fence *s_fence = to_drm_sched_fence(fence);
                                                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
Move this below the error handling.

67dd1a363 Andrey Grodzovsky 2019-01-31  1097  			struct dma_fence *old = fence;
67dd1a363 Andrey Grodzovsky 2019-01-31  1098  
67dd1a363 Andrey Grodzovsky 2019-01-31  1099  			fence = dma_fence_get(&s_fence->scheduled);
67dd1a363 Andrey Grodzovsky 2019-01-31  1100  			dma_fence_put(old);
67dd1a363 Andrey Grodzovsky 2019-01-31  1101  		}
67dd1a363 Andrey Grodzovsky 2019-01-31  1102  
21c16bf63 Christian König   2015-07-07  1103  		if (IS_ERR(fence)) {
                                                            ^^^^^^^^^^^^

21c16bf63 Christian König   2015-07-07  1104  			r = PTR_ERR(fence);
76a1ea618 Christian König   2015-07-06  1105  			amdgpu_ctx_put(ctx);
2b48d323b Christian König   2015-06-19  1106  			return r;
21c16bf63 Christian König   2015-07-07  1107  		} else if (fence) {
                                                                   ^^^^^

cebb52b7b Andrey Grodzovsky 2017-11-13  1108  			r = amdgpu_sync_fence(p->adev, &p->job->sync, fence,
cebb52b7b Andrey Grodzovsky 2017-11-13  1109  					true);
f54d18670 Chris Wilson      2016-10-25  1110  			dma_fence_put(fence);
76a1ea618 Christian König   2015-07-06  1111  			amdgpu_ctx_put(ctx);
91e1a5207 Christian König   2015-07-06  1112  			if (r)
91e1a5207 Christian König   2015-07-06  1113  				return r;
2b48d323b Christian König   2015-06-19  1114  		}
2b48d323b Christian König   2015-06-19  1115  	}
6f0308ebc Dave Airlie       2017-03-09  1116  	return 0;
6f0308ebc Dave Airlie       2017-03-09  1117  }
6f0308ebc Dave Airlie       2017-03-09  1118  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux