From patchwork Mon Nov 20 22:49:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13462226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB937C54E76 for ; Mon, 20 Nov 2023 22:49:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637328.993078 (Exim 4.92) (envelope-from ) id 1r5D59-0005yz-Qu; Mon, 20 Nov 2023 22:49:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637328.993078; Mon, 20 Nov 2023 22:49:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D59-0005yU-Il; Mon, 20 Nov 2023 22:49:31 +0000 Received: by outflank-mailman (input) for mailman id 637328; Mon, 20 Nov 2023 22:49:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5D58-0005pp-0G for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 22:49:30 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0d40d0f7-87f7-11ee-9b0e-b553b5be7939; Mon, 20 Nov 2023 23:49:26 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0d40d0f7-87f7-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700520566; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KkoH8o86oD3O0Ak+wVVUBX4N9gH8HsFtd6JZOUHqS1o=; b=c09Exnye5lku1hWOJRPzaKZfyY1Tmv9FR37eZjlRO8FgQVezXdQ+6TsH 0+Od9eQCr93rJex1VUvxmyc9K4Z/7jJe2V4kYf1fK9BPU6pONsUQVqYUi 0GmladJGPzG9M0Tq1B/WHFTBuEskn4w1tZsWc+Muvpo+kiWdQB44E/YDT E=; X-CSE-ConnectionGUID: LtYo8xJLRvC+jqiF6E23hw== X-CSE-MsgGUID: 6O6XcPceSZ2koK5f5Nn6tg== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127436305 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:3MPTDq+LoP2SHNuUIsiQDrUDX36TJUtcMsCJ2f8bNWPcYEJGY0x3m GJLWGuAbPiLN2qgf9wgboTg8U4D75aEm4NhTAJs+yA8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjVAOK6UKidYnwZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ird7ksz1BjOkGlA5AdnPKoT5AW2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklq6 c0feCAvSiqdrKG02bOVFMQ23cQ8eZyD0IM34hmMzBncBP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 9a23:Nr5UswmcUORqbrt/l8Sfdno8E5lY6JylBXs/y5YBmJSKaAp2ZSuS2WE= X-IronPort-AV: E=Sophos;i="6.04,214,1695700800"; d="scan'208";a="127436305" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Roberto Bagnara , Nicola Vetrini Subject: [PATCH 4/6] arm/duart: make dt_uart_init() compile with -Wwrite-strings Date: Mon, 20 Nov 2023 22:49:10 +0000 Message-ID: <20231120224912.1421916-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120224912.1421916-1-andrew.cooper3@citrix.com> References: <20231120224912.1421916-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 GCC complains: drivers/char/arm-uart.c: In function 'dt_uart_init': drivers/char/arm-uart.c:81:17: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 81 | options = ""; | ^ The problem is using the options string for both splitting opt_duart, and to hold a token "" for no options. Use two variables; one mutable one one const. Signed-off-by: Andrew Cooper Reviewed-by: Stefano Stabellini --- CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Roberto Bagnara CC: Nicola Vetrini --- xen/drivers/char/arm-uart.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/drivers/char/arm-uart.c b/xen/drivers/char/arm-uart.c index 8098a968c285..91f13a41368d 100644 --- a/xen/drivers/char/arm-uart.c +++ b/xen/drivers/char/arm-uart.c @@ -42,7 +42,8 @@ static void __init dt_uart_init(void) struct dt_device_node *dev; int ret; const char *devpath = opt_dtuart; - char *options; + const char *options; + char *split; if ( !console_has("dtuart") ) return; /* Not for us */ @@ -74,9 +75,12 @@ static void __init dt_uart_init(void) return; } - options = strchr(opt_dtuart, ':'); - if ( options != NULL ) - *(options++) = '\0'; + split = strchr(opt_dtuart, ':'); + if ( split ) + { + split[0] = '\0'; + options = split + 1; + } else options = "";