Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3101229pxm; Mon, 28 Feb 2022 12:02:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwAIN8+3PXctpYrnnnFdhU6vYU+d+Tj1QCHuXX9u7OixJSLX/cAnw2HnySxhlsR4csjx9U X-Received: by 2002:a17:903:3092:b0:14f:9c1c:45a4 with SMTP id u18-20020a170903309200b0014f9c1c45a4mr21854585plc.126.1646078540510; Mon, 28 Feb 2022 12:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646078540; cv=none; d=google.com; s=arc-20160816; b=v6Ticee8YwDFvVy/7ZeTLQaqzKsda72vtrXAVh05Sc7q9k2IFJp6mqHOLOQiG/SA/I K8TdR0Sm1gCsl0qmeG6QMr1yRymYwqjl6uCHboz1XQucr/lszabcoIHcpeGUpDP+41tK xhBP1CuoHOfT8QBtdAb5Q3mQaGtcuwFwM/XvAotkgPKNQAuFq4n67JBONLCnoDNx0KoF BuvXM9WHZHXI/y1ozgCDjGX2m+PTg0ti6Zstn+N5QkT/4XKlf/xeqJOgR81pUMWifgCg 9DyIs5owLQrqe1wpYmyi7xOy32bJSKz65Enq/fnK+OBD9UYZy5Omwl+fEazagre50fyr q1JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YR1/jlTZSQPxD81csOAIAfLa4i4Sxv2/d+YrNe2qW7A=; b=hZn8TiQJaPMVIxiSRsvBpmfkWxHyiGvrcawAg88ZJBc17wqCrRqJD39iXQO2RHCNob 7vEvHLqMc2mw/g5Ql1QfQqzuazAhUv7/8rcpbxYk0MXv2v/wCwEV5JnuChln9H2rstJh kTlEt+JJnHybo62C+TZRv/poTIRjNIzhuIN4d4KD0lPbraZsV5sSfa2Dxrw9MvAm86iO kvXS1Yjjhox2OdEUJAXChQAu6k+N0S72VefUSzwbdPich7YCc5DMu6uV+H3LN5tmx5yT WPSAzBmaCqFUf4Pn0bEgsDvV4NPYp6yyToHiUjUsW5P4KrpD9GomUw+BaV6Y4bJGA7x9 6pxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=mgQm10fU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g10-20020a056a0023ca00b004f1338b8bc7si11315762pfc.377.2022.02.28.12.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 12:02:20 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=mgQm10fU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1A6BC12558D; Mon, 28 Feb 2022 11:31:06 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240761AbiB1Sdi (ORCPT + 99 others); Mon, 28 Feb 2022 13:33:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241085AbiB1SdE (ORCPT ); Mon, 28 Feb 2022 13:33:04 -0500 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8130B25C5D for ; Mon, 28 Feb 2022 10:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=YR1/jlTZSQPxD81csOAIAfLa4i4Sxv2/d+YrNe2qW7A=; b=mgQm10fUVc9kgc4Wgk3J5S1tEy ZVUa9ujYT89jNZnWgbg+tdJuwBTdMkj+8bNxgSeW+YjGu9U95HEFEiPsVx8HpRRUwXJKpSOQIuBoW Jll8UiiMU3grQc+McvEtzRjq+gxZQwFXWQKk+F1tl9rqSj8hyf5GD4cPMgvhm9iVJcAqjWtT16qIh 3uvZlrB1WXoLyRY4wJ062pjDfnfJNui/VQuor4H3YNeAVf6kD9E0Aneyz0n0VEQmrzILEjCyDsJxU T4NJtSeRNjnF+dgUEsd/AyEbPxQjzshS4Zx53VgwcJDLtTjUNv4lLw8QVA9blj3CBzO8FuEXA7XV4 W9R2PLYg==; Received: from [165.90.126.25] (helo=killbill.home) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1nOkaE-0003pp-3P; Mon, 28 Feb 2022 19:17:18 +0100 From: Melissa Wen To: emma@anholt.net, airlied@linux.ie, daniel@ffwll.ch Cc: Jiawei.Gu@amd.com, andrey.grodzovsky@amd.com, christian.koenig@amd.com, Melissa Wen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/v3d: centralize error handling when init scheduler fails Date: Mon, 28 Feb 2022 17:16:47 -0100 Message-Id: <20220228181647.3794298-1-mwen@igalia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove redundant error message (since now it is very similar to what we do in drm_sched_init) and centralize all error handling in a unique place, as we follow the same steps in any case of failure. Signed-off-by: Melissa Wen --- drivers/gpu/drm/v3d/v3d_sched.c | 40 +++++++++++---------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index 39459ae96f30..06238e6d7f5c 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -392,34 +392,24 @@ v3d_sched_init(struct v3d_dev *v3d) hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, NULL, "v3d_bin", v3d->drm.dev); - if (ret) { - dev_err(v3d->drm.dev, "Failed to create bin scheduler: %d.", ret); + if (ret) return ret; - } ret = drm_sched_init(&v3d->queue[V3D_RENDER].sched, &v3d_render_sched_ops, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, NULL, "v3d_render", v3d->drm.dev); - if (ret) { - dev_err(v3d->drm.dev, "Failed to create render scheduler: %d.", - ret); - v3d_sched_fini(v3d); - return ret; - } + if (ret) + goto fail; ret = drm_sched_init(&v3d->queue[V3D_TFU].sched, &v3d_tfu_sched_ops, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, NULL, "v3d_tfu", v3d->drm.dev); - if (ret) { - dev_err(v3d->drm.dev, "Failed to create TFU scheduler: %d.", - ret); - v3d_sched_fini(v3d); - return ret; - } + if (ret) + goto fail; if (v3d_has_csd(v3d)) { ret = drm_sched_init(&v3d->queue[V3D_CSD].sched, @@ -427,27 +417,23 @@ v3d_sched_init(struct v3d_dev *v3d) hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, NULL, "v3d_csd", v3d->drm.dev); - if (ret) { - dev_err(v3d->drm.dev, "Failed to create CSD scheduler: %d.", - ret); - v3d_sched_fini(v3d); - return ret; - } + if (ret) + goto fail; ret = drm_sched_init(&v3d->queue[V3D_CACHE_CLEAN].sched, &v3d_cache_clean_sched_ops, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, NULL, "v3d_cache_clean", v3d->drm.dev); - if (ret) { - dev_err(v3d->drm.dev, "Failed to create CACHE_CLEAN scheduler: %d.", - ret); - v3d_sched_fini(v3d); - return ret; - } + if (ret) + goto fail; } return 0; + +fail: + v3d_sched_fini(v3d); + return ret; } void -- 2.34.1