From: Vinod Koul <vkoul@kernel.org>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Peng Ma <peng.ma@nxp.com>,
Dan Williams <dan.j.williams@intel.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
clang-built-linux@googlegroups.com
Subject: Re: [PATCH -next] dmaengine: fsl-dpaa2-qdma: Remove unnecessary local variables in DPDMAI_CMD_CREATE macro
Date: Sat, 2 Nov 2019 22:03:19 +0530 [thread overview]
Message-ID: <20191102163319.GD2695@vkoul-mobl.Dlink> (raw)
In-Reply-To: <20191022171648.37732-1-natechancellor@gmail.com>
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
prev parent reply other threads:[~2019-11-02 16:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 17:16 Nathan Chancellor
2019-11-02 16:33 ` Vinod Koul [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191102163319.GD2695@vkoul-mobl.Dlink \
--to=vkoul@kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=peng.ma@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®