From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755310AbdCWMPg (ORCPT ); Thu, 23 Mar 2017 08:15:36 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:31038 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbdCWMPe (ORCPT ); Thu, 23 Mar 2017 08:15:34 -0400 Subject: Re: [PATCH 1/2] tty: serial_core: Add name field to uart_port struct To: Andy Shevchenko References: <20170321133636.8814-1-vigneshr@ti.com> <20170321133636.8814-2-vigneshr@ti.com> CC: Greg Kroah-Hartman , Jiri Slaby , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" , linux-arm Mailing List , Jisheng Zhang From: Vignesh R Message-ID: <61fd3976-1160-f0cb-15ce-91c46f3d749e@ti.com> Date: Thu, 23 Mar 2017 17:43:36 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 23 March 2017 12:15 AM, Andy Shevchenko wrote: > On Tue, Mar 21, 2017 at 3:36 PM, Vignesh R wrote: >> Introduce a field to store name of uart_port that can be used to easily >> identify uart port instances on a system that has more than one uart > > uart -> UART > >> instance. The name is of the form ttyXN(eg. ttyS0, ttyAMA0,..) where N >> is number that particular uart instance. >> This field will be useful when printing debug info for a particular port >> or in register irqs with unique irq name. Port name is populated during > > irq(s) -> IRQ(s) > >> uart_add_one_port(). > >> + snprintf(uport->name, sizeof(uport->name), "%s%d", drv->dev_name, >> + drv->tty_driver->name_base + uport->line); > > This is fragile. dev_name is defined as pointer, so, it would be any length. > So, better to use [devm_]kasprintf(). > Ok, will you use kasprintf() (and corresponding kfree()) as device is not yet allocated at this stage to use devm_*. -- Regards Vignesh