[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191102163319.GD2695@vkoul-mobl.Dlink>
Date: Sat, 2 Nov 2019 22:03:19 +0530
From: Vinod Koul <vkoul@...nel.org>
To: Nathan Chancellor <natechancellor@...il.com>
Cc: Peng Ma <peng.ma@....com>, Dan Williams <dan.j.williams@...el.com>,
dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
clang-built-linux@...glegroups.com
Subject: Re: [PATCH -next] dmaengine: fsl-dpaa2-qdma: Remove unnecessary
local variables in DPDMAI_CMD_CREATE macro
On 22-10-19, 10:16, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/dma/fsl-dpaa2-qdma/dpdmai.c:148:25: warning: variable 'cfg' is
> uninitialized when used within its own initialization [-Wuninitialized]
> DPDMAI_CMD_CREATE(cmd, cfg);
> ~~~~~~~~~~~~~~~~~~~~~~~^~~~
> drivers/dma/fsl-dpaa2-qdma/dpdmai.c:42:24: note: expanded from macro
> 'DPDMAI_CMD_CREATE'
> typeof(_cfg) (cfg) = (_cfg); \
> ~~~ ^~~~
> 1 warning generated.
>
> Looking at the preprocessed source, we can see that this is true.
>
> int dpdmai_create(struct fsl_mc_io *mc_io, u32 cmd_flags,
> const struct dpdmai_cfg *cfg, u16 *token)
> {
> struct fsl_mc_command cmd = { 0 };
> int err;
>
> cmd.header = mc_encode_cmd_header((((0x90E) << 4) | 0), cmd_flags, 0);
> do {
> typeof(cmd)(cmd) = (cmd);
> typeof(cfg)(cfg) = (cfg);
> ((cmd).params[0] |= mc_enc((8), (8), (cfg)->priorities[0]));
> ((cmd).params[0] |= mc_enc((16), (8), (cfg)->priorities[1]));
> } while (0);
>
> I cannot see a good reason to create another version of cfg when the
> parameter one will work perfectly fine and cmd can just be used as is.
> Remove them to fix this warning.
Applied, thanks
--
~Vinod
Powered by blists - more mailing lists