* [bug report] drm/amdkfd: Add SDMA user-mode queues support to QCM
@ 2017-07-11 20:03 Dan Carpenter
2017-09-02 11:45 ` Oded Gabbay
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-07-11 20:03 UTC (permalink / raw)
To: ben.goz-5C7GfCeVMHo; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Hello Ben Goz,
The patch bcea30817574: "drm/amdkfd: Add SDMA user-mode queues
support to QCM" from Jan 3, 2015, leads to the following static
checker warning:
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c:191 create_queue_nocpsch()
error: uninitialized symbol 'retval'.
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
155 static int create_queue_nocpsch(struct device_queue_manager *dqm,
156 struct queue *q,
157 struct qcm_process_device *qpd,
158 int *allocated_vmid)
159 {
160 int retval;
^^^^^^
161
162 BUG_ON(!dqm || !q || !qpd || !allocated_vmid);
163
164 pr_debug("kfd: In func %s\n", __func__);
165 print_queue(q);
166
167 mutex_lock(&dqm->lock);
168
169 if (dqm->total_queue_count >= max_num_of_queues_per_device) {
170 pr_warn("amdkfd: Can't create new usermode queue because %d queues were already created\n",
171 dqm->total_queue_count);
172 mutex_unlock(&dqm->lock);
173 return -EPERM;
174 }
175
176 if (list_empty(&qpd->queues_list)) {
177 retval = allocate_vmid(dqm, qpd, q);
178 if (retval != 0) {
179 mutex_unlock(&dqm->lock);
180 return retval;
181 }
182 }
183 *allocated_vmid = qpd->vmid;
184 q->properties.vmid = qpd->vmid;
185
186 if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE)
187 retval = create_compute_queue_nocpsch(dqm, q, qpd);
188 if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
189 retval = create_sdma_queue_nocpsch(dqm, q, qpd);
There are a couple other options besides KFD_QUEUE_TYPE_COMPUTE and
KFD_QUEUE_TYPE_SDMA. We should just add an:
else
retval = -EINVAL;
to future proof the code, if nothing else.
190
191 if (retval != 0) {
192 if (list_empty(&qpd->queues_list)) {
193 deallocate_vmid(dqm, qpd, q);
194 *allocated_vmid = 0;
195 }
196 mutex_unlock(&dqm->lock);
197 return retval;
198 }
regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] drm/amdkfd: Add SDMA user-mode queues support to QCM
2017-07-11 20:03 [bug report] drm/amdkfd: Add SDMA user-mode queues support to QCM Dan Carpenter
@ 2017-09-02 11:45 ` Oded Gabbay
0 siblings, 0 replies; 2+ messages in thread
From: Oded Gabbay @ 2017-09-02 11:45 UTC (permalink / raw)
To: Dan Carpenter; +Cc: amd-gfx list
On Tue, Jul 11, 2017 at 11:03 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> Hello Ben Goz,
>
> The patch bcea30817574: "drm/amdkfd: Add SDMA user-mode queues
> support to QCM" from Jan 3, 2015, leads to the following static
> checker warning:
>
> drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c:191 create_queue_nocpsch()
> error: uninitialized symbol 'retval'.
>
> drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> 155 static int create_queue_nocpsch(struct device_queue_manager *dqm,
> 156 struct queue *q,
> 157 struct qcm_process_device *qpd,
> 158 int *allocated_vmid)
> 159 {
> 160 int retval;
> ^^^^^^
> 161
> 162 BUG_ON(!dqm || !q || !qpd || !allocated_vmid);
> 163
> 164 pr_debug("kfd: In func %s\n", __func__);
> 165 print_queue(q);
> 166
> 167 mutex_lock(&dqm->lock);
> 168
> 169 if (dqm->total_queue_count >= max_num_of_queues_per_device) {
> 170 pr_warn("amdkfd: Can't create new usermode queue because %d queues were already created\n",
> 171 dqm->total_queue_count);
> 172 mutex_unlock(&dqm->lock);
> 173 return -EPERM;
> 174 }
> 175
> 176 if (list_empty(&qpd->queues_list)) {
> 177 retval = allocate_vmid(dqm, qpd, q);
> 178 if (retval != 0) {
> 179 mutex_unlock(&dqm->lock);
> 180 return retval;
> 181 }
> 182 }
> 183 *allocated_vmid = qpd->vmid;
> 184 q->properties.vmid = qpd->vmid;
> 185
> 186 if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE)
> 187 retval = create_compute_queue_nocpsch(dqm, q, qpd);
> 188 if (q->properties.type == KFD_QUEUE_TYPE_SDMA)
> 189 retval = create_sdma_queue_nocpsch(dqm, q, qpd);
>
>
> There are a couple other options besides KFD_QUEUE_TYPE_COMPUTE and
> KFD_QUEUE_TYPE_SDMA. We should just add an:
>
> else
> retval = -EINVAL;
>
> to future proof the code, if nothing else.
>
> 190
> 191 if (retval != 0) {
> 192 if (list_empty(&qpd->queues_list)) {
> 193 deallocate_vmid(dqm, qpd, q);
> 194 *allocated_vmid = 0;
> 195 }
> 196 mutex_unlock(&dqm->lock);
> 197 return retval;
> 198 }
>
> regards,
> dan carpenter
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Dan, thanks.
The fix was added as part of a patch-set to be included in the
upcoming merge window.
Oded
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-02 11:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-11 20:03 [bug report] drm/amdkfd: Add SDMA user-mode queues support to QCM Dan Carpenter
2017-09-02 11:45 ` Oded Gabbay
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.