There is no point in having a log message whose only purpose is to notify developers of incorrect usage of the API while bringing up a new driver. Lets simply return an error and let the developers figure it out.
Signed-off-by: Tvrtko Ursulin <[email protected]> Cc: Christian König <[email protected]> Cc: Danilo Krummrich <[email protected]> Cc: Matthew Brost <[email protected]> Cc: Philipp Stanner <[email protected]> --- drivers/gpu/drm/scheduler/sched_main.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index bb89c169d553..76acd0e4339c 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -1105,6 +1105,9 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, const struct drm_sched_init_ if (sched->sched_rq) return -EINVAL; + if (args->num_rqs > DRM_SCHED_PRIORITY_COUNT) + return -EINVAL; + sched->ops = args->ops; sched->credit_limit = args->credit_limit; sched->name = args->name; @@ -1114,14 +1117,6 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, const struct drm_sched_init_ sched->score = args->score ? args->score : &sched->_score; sched->dev = args->dev; - if (args->num_rqs > DRM_SCHED_PRIORITY_COUNT) { - /* This is a gross violation--tell drivers what the problem is. - */ - dev_err(sched->dev, "%s: num_rqs cannot be greater than DRM_SCHED_PRIORITY_COUNT\n", - __func__); - return -EINVAL; - } - if (args->submit_wq) { sched->submit_wq = args->submit_wq; sched->own_submit_wq = false; -- 2.55.0
