From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97DDEEB64DA for ; Wed, 19 Jul 2023 05:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229458AbjGSFc1 (ORCPT ); Wed, 19 Jul 2023 01:32:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbjGSFcX (ORCPT ); Wed, 19 Jul 2023 01:32:23 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E76DD2; Tue, 18 Jul 2023 22:32:22 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id C506E80AA; Wed, 19 Jul 2023 05:32:21 +0000 (UTC) Date: Wed, 19 Jul 2023 08:32:20 +0300 From: Tony Lindgren To: Jiri Slaby Cc: Greg Kroah-Hartman , Andy Shevchenko , Dhruva Gole , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-omap@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: core: Add support for dev_name:0.0 naming for kernel console Message-ID: <20230719053220.GI5194@atomide.com> References: <20230719051525.46494-1-tony@atomide.com> <35758c24-1543-6f96-7957-b371dc94e59d@kernel.org> <20230719052811.GH5194@atomide.com> <87431096-e883-c90d-853e-44a463c0e8f2@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87431096-e883-c90d-853e-44a463c0e8f2@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jiri Slaby [230719 05:29]: > On 19. 07. 23, 7:28, Tony Lindgren wrote: > > * Jiri Slaby [230719 05:25]: > > > On 19. 07. 23, 7:15, Tony Lindgren wrote: > > > > +/* > > > > + * Add preferred console if configured on kernel command line with naming > > > > + * "console=dev_name:0.0". > > > > + */ > > > > +static int serial_core_add_preferred_console(struct uart_driver *drv, > > > > + struct uart_port *port) > > > > +{ > > > > + char *port_match, *opt, *name; > > > > + int len, ret = 0; > > > > + > > > > + port_match = kasprintf(GFP_KERNEL, "console=%s:%i.%i", > > > > + dev_name(port->dev), port->ctrl_id, > > > > + port->port_id); > > > > + if (!port_match) > > > > + return -ENOMEM; > > > > + > > > > + opt = strstr(saved_command_line, port_match); > > > > + if (!opt) > > > > + goto free_port_match; > > > > + > > > > + len = strlen(port_match); > > > > + > > > > + if (strlen(opt) > len + 1 && opt[len] == ',') > > > > + opt += len + 1; > > > > + else > > > > + opt = NULL; > > > > + > > > > + name = kstrdup(drv->dev_name, GFP_KERNEL); > > > > > > Why do you dup the name here? > > > > I was getting ignoring const warning, but maybe the right solution is > > to just use const char *name here.. Let me check. > > So fix add_preferred_console() instead ;). Let's see what kind of trouble changing it to use const char *name might be. Tony