[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e887c990-8cba-62b0-0f47-3ea0c166d603@ti.com>
Date: Fri, 17 Apr 2020 08:39:39 -0500
From: Suman Anna <s-anna@...com>
To: Markus Elfring <Markus.Elfring@....de>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
<linux-remoteproc@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, Alex Elder <elder@...aro.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Ohad Ben-Cohen <ohad@...ery.com>
Subject: Re: [PATCH v2 5/7] remoteproc: Restructure firmware name allocation
Hi Markus,
On 4/16/20 1:26 AM, Markus Elfring wrote:
> …
>> +++ b/drivers/remoteproc/remoteproc_core.c
>> @@ -1984,14 +1984,14 @@ static int rproc_alloc_firmware(struct rproc *rproc,
>> {
>> const char *p;
>>
>> - if (!firmware)
>> + if (firmware)
>> + p = kstrdup_const(firmware, GFP_KERNEL);
>> + else
>> /*
>> * If the caller didn't pass in a firmware name then
>> * construct a default name.
>> */
>> p = kasprintf(GFP_KERNEL, "rproc-%s-fw", name);
>> - else
>> - p = kstrdup_const(firmware, GFP_KERNEL);
>
> Can the use of the conditional operator make sense at such source code places?
>
> p = firmware ? kstrdup_const(…) : kasprintf(…);
For simple assignments, I too prefer the ternary operator, but in this
case, I think it is better to leave the current code as is.
regards
Suman
Powered by blists - more mailing lists