From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7C474778E; Mon, 1 Apr 2024 16:21:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711988472; cv=none; b=Nh/XPLNWySpv4UeYyfsgsxAyGSd81FwThXEgMk/SIHRsxOEXrgEeMXzHwVcDBjXDFAm0NzIg92YUYh90iV6sxE9sh2jubYbe3DwTkBMR+YWPE4OKMb35Lxq8Pi80HcPu17+YfuvGCEtgbQMWEnUoILb1GOqXQni3T/GjmifOQrk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711988472; c=relaxed/simple; bh=1JHVTAdRzwZofbaFwWrvH1LJ/ovwq7fq/NQTfaWzE2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AshJEBWwP6eIINg9GgZjKQe/xfXx8pvN8kBpacerMUZYuvFe8vh9DKpXOam8Zs8HhI/HOHNIb0P+kUbxLclX8lcu8lHw2guc1hOOHXrUZEqMsBm16+J/lUfszlqtrcZrLp4xVN49bBkyDNLXt6cDKCyrfb5s6AD1tslUQbISha4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ot9aTt6d; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ot9aTt6d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 162BAC433C7; Mon, 1 Apr 2024 16:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711988472; bh=1JHVTAdRzwZofbaFwWrvH1LJ/ovwq7fq/NQTfaWzE2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ot9aTt6d1zrMXLyDw0NdC7uIc817wppOflWjoWb0wFdizZ4Yh9YJdQLNAKSCxg3P/ UCdGIv98t6D8OY42JYRHmXjlJRfxe3GkzJQu3+PAeN8QNWrLDofJ69OphpnHTu7lVN Cj0rVSHrF4fbNRftJShCJe6GV+ICyEeI+12Wno5I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Neil Armstrong , Jessica Zhang , Sam Ravnborg , Thomas Zimmermann , Jani Nikula , Sasha Levin Subject: [PATCH 6.7 166/432] drm/panel: do not return negative error codes from drm_panel_get_modes() Date: Mon, 1 Apr 2024 17:42:33 +0200 Message-ID: <20240401152558.096511516@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152553.125349965@linuxfoundation.org> References: <20240401152553.125349965@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jani Nikula [ Upstream commit fc4e97726530241d96dd7db72eb65979217422c9 ] None of the callers of drm_panel_get_modes() expect it to return negative error codes. Either they propagate the return value in their struct drm_connector_helper_funcs .get_modes() hook (which is also not supposed to return negative codes), or add it to other counts leading to bogus values. On the other hand, many of the struct drm_panel_funcs .get_modes() hooks do return negative error codes, so handle them gracefully instead of propagating further. Return 0 for no modes, whatever the reason. Cc: Neil Armstrong Cc: Jessica Zhang Cc: Sam Ravnborg Cc: stable@vger.kernel.org Reviewed-by: Neil Armstrong Reviewed-by: Jessica Zhang Acked-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/79f559b72d8c493940417304e222a4b04dfa19c4.1709913674.git.jani.nikula@intel.com Signed-off-by: Jani Nikula Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_panel.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index e814020bbcd3b..cfbe020de54e0 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -274,19 +274,24 @@ EXPORT_SYMBOL(drm_panel_disable); * The modes probed from the panel are automatically added to the connector * that the panel is attached to. * - * Return: The number of modes available from the panel on success or a - * negative error code on failure. + * Return: The number of modes available from the panel on success, or 0 on + * failure (no modes). */ int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector) { if (!panel) - return -EINVAL; + return 0; - if (panel->funcs && panel->funcs->get_modes) - return panel->funcs->get_modes(panel, connector); + if (panel->funcs && panel->funcs->get_modes) { + int num; - return -EOPNOTSUPP; + num = panel->funcs->get_modes(panel, connector); + if (num > 0) + return num; + } + + return 0; } EXPORT_SYMBOL(drm_panel_get_modes); -- 2.43.0