From: Dan Carpenter <dan.carpenter@oracle.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, clang-built-linux@googlegroups.com,
Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: kpc2000: Use memset to initialize resources
Date: Tue, 30 Apr 2019 12:12:42 +0300 [thread overview]
Message-ID: <20190430091242.GA2269@kadam> (raw)
In-Reply-To: <20190424185742.7797-1-natechancellor@gmail.com>
On Wed, Apr 24, 2019 at 11:57:43AM -0700, Nathan Chancellor wrote:
> diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> index ad2cc0a3bfa1..13f544f3c0b9 100644
> --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
> +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> @@ -93,8 +93,8 @@ void parse_core_table_entry(struct core_table_entry *cte, const u64 read_val, co
> int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard, char *name, const struct core_table_entry cte)
> {
> struct mfd_cell cell = {0};
> - struct resource resources[2] = {0};
> -
> + struct resource resources[2];
> +
> struct kpc_core_device_platdata core_pdata = {
Greg already applied this and that's cool but I would have probably
gone with "struct resource resources[2] = {};". memset() is only
required if we want to clear out the struct holes because we're going to
copy the whole struct to userspace. (Some compilers will change
foo = {} into "foo.a = 0; foo.b = 0;" when it's faster than doing a
memset, so the struct holes don't always get cleared).
Also it was risky from a process perspective to delete the stray tab
from the next line because some one could have argued that it was
unrelated or that the whole line should be removed instead. You would
have had to redo the patch for something silly... #YOLO #LivingOnTheEdge
But in this case, it's already applied so everything worked out. :)
regards,
dan carpenter
next prev parent reply other threads:[~2019-04-30 9:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 18:57 Nathan Chancellor
2019-04-24 22:44 ` Nick Desaulniers
2019-04-30 9:12 ` Dan Carpenter [this message]
2019-04-30 20:28 ` Nick Desaulniers
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=20190430091242.GA2269@kadam \
--to=dan.carpenter@oracle.com \
--cc=clang-built-linux@googlegroups.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.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
Powered by JetHome