From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Date: Fri, 17 Apr 2020 14:58:51 -0600 From: Mathieu Poirier Subject: Re: [v2 5/7] remoteproc: Restructure firmware name allocation Message-ID: <20200417205851.GA10372@xps15> References: <20200415204858.2448-1-mathieu.poirier@linaro.org> <20200415204858.2448-6-mathieu.poirier@linaro.org> <7a978c24-945d-8d39-3a0a-30e0678d569a@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7a978c24-945d-8d39-3a0a-30e0678d569a@web.de> To: Markus Elfring Cc: Suman Anna , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Elder , Bjorn Andersson , Ohad Ben-Cohen List-ID: Hi Markus, On Fri, Apr 17, 2020 at 05:48:49PM +0200, Markus Elfring wrote: > >>     p = firmware ? kstrdup_const(…) : kasprintf(…); > > > > For simple assignments, I too prefer the ternary operator, > > Thanks for your feedback. > > > > but in this case, I think it is better to leave the current code as is. > > Would you like to consider the use of the function “kvasprintf_const” > according to your review comment for the update step “[PATCH v2 4/7] remoteproc: > Use kstrdup_const() rather than kstrup()”? > Looking at the implementation of kvasprintf_const(), using it here wouldn't give us anything. Indeed allocation of duplicate memory is avoided only if the string is pre determined of if it is exactly %s, which isn't the case here. Otherwise things default to kvasprintf(). Thanks, Mathieu > Regards, > Markus