lkml.org 
[lkml]   [2020]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 5/7] remoteproc: Restructure firmware name allocation
From
Date

> +++ 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(…);

Regards,
Markus

\
 
 \ /
  Last update: 2020-04-16 08:27    [W:0.285 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site