From patchwork Mon Nov 18 15:51:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 11249921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9C6214E5 for ; Mon, 18 Nov 2019 15:52:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B22EF21906 for ; Mon, 18 Nov 2019 15:52:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B22EF21906 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E53C76E5C3; Mon, 18 Nov 2019 15:52:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id E1C216E5C3 for ; Mon, 18 Nov 2019 15:51:55 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-MYOi-fvLPAmPy4jaZAHS0Q-1; Mon, 18 Nov 2019 10:51:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED14A8A218E; Mon, 18 Nov 2019 15:51:49 +0000 (UTC) Received: from shalem.localdomain.com (unknown [10.36.118.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A4A1600CD; Mon, 18 Nov 2019 15:51:48 +0000 (UTC) From: Hans de Goede To: Maarten Lankhorst , Maxime Ripard , Sean Paul , Daniel Vetter , David Airlie Subject: [PATCH v3 07/13] drm/modes: parse_cmdline: Set bpp/refresh_specified after successful parsing Date: Mon, 18 Nov 2019 16:51:28 +0100 Message-Id: <20191118155134.30468-7-hdegoede@redhat.com> In-Reply-To: <20191118155134.30468-1-hdegoede@redhat.com> References: <20191118155134.30468-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: MYOi-fvLPAmPy4jaZAHS0Q-1 X-Mimecast-Spam-Score: 0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574092314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vGvqf8aTqAiNCsenFw7/SVuCP0FRm5J7zSw/79yxVXQ=; b=de++gG8L/zw12Vh/CZQ5t9NxihBbAr84ydBNbQEl5WyS4GWb+SUhe5qTIMixlq5iBZyHUp +cBGCzYIhifICW/dbIDFmSMLVPbxfpkWXDu/usVEkIyFDSpNTarMYP4s9A9MQjeLCZbvnw NVFCf2rLNClY1yvI1VJZe6e0hIUt0no= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans de Goede , Derek Basehore , =?utf-8?q?Mathieu_Alexandre-T?= =?utf-8?q?=C3=A9treault?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_connector_get_cmdline_mode() calls drm_mode_parse_command_line_for_connector() with &connector->cmdline_mode as mode argument, so anything which we store in the mode arguments gets kept even if we return false. Avoid storing a possibly false-postive bpp/refresh_specified setting in connector->cmdline_mode by moving the setting of these to after successful parsing of the bpp/refresh parts of the video= argument. Acked-by: Maxime Ripard Signed-off-by: Hans de Goede --- drivers/gpu/drm/drm_modes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 80cb247c83c7..72828fa9fc91 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -1771,10 +1771,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, /* Try to locate the bpp and refresh specifiers, if any */ bpp_ptr = strchr(name, '-'); - if (bpp_ptr) { + if (bpp_ptr) bpp_off = bpp_ptr - name; - mode->bpp_specified = true; - } refresh_ptr = strchr(name, '@'); if (refresh_ptr) { @@ -1782,7 +1780,6 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, return false; refresh_off = refresh_ptr - name; - mode->refresh_specified = true; } /* Locate the start of named options */ @@ -1825,6 +1822,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode); if (ret) return false; + + mode->bpp_specified = true; } if (refresh_ptr) { @@ -1832,6 +1831,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, &refresh_end_ptr, mode); if (ret) return false; + + mode->refresh_specified = true; } /*