From: Greg KH <gregkh@linuxfoundation.org>
To: Shivani Bhardwaj <shivanib134@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] Staging: unisys: visorbus: visorchipset: Converted arrays to static const
Date: Wed, 30 Sep 2015 03:59:31 +0200 [thread overview]
Message-ID: <20150930015931.GA14259@kroah.com> (raw)
In-Reply-To: <20150929232413.GA16457@ubuntu>
On Wed, Sep 30, 2015 at 04:54:13AM +0530, Shivani Bhardwaj wrote:
> Replaced the declaration of character array from char * to
> static const char * const as the array is not intended to be used
> anywhere outside the function plus the values in array and the pointer
> to it don't have to be changed.
>
> Signed-off-by: Shivani Bhardwaj <shivanib134@gmaail.com>
> ---
> drivers/staging/unisys/visorbus/visorchipset.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
> index 4b76cb4..073b45b 100644
> --- a/drivers/staging/unisys/visorbus/visorchipset.c
> +++ b/drivers/staging/unisys/visorbus/visorchipset.c
> @@ -1411,7 +1411,7 @@ static int
> visorchipset_chipset_selftest(void)
> {
> char env_selftest[20];
> - char *envp[] = { env_selftest, NULL };
> + static const char * const envp[] = { env_selftest, NULL };
The compiler didn't complain when you did this? That's really strange,
it should have.
Think about what you just turned envp into, and how env_selftest could
ever be correct now, given that the scope lifetime rules just changed
between the two variables.
I would leave this one alone, it's tricky and odds are, something is
going to be wrong with changing it, there's nothing wrong with the
original code as-is.
thanks,
greg k-h
next prev parent reply other threads:[~2015-09-30 2:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 23:24 [PATCH] Staging: unisys: visorbus: visorchipset: Converted arrays to static const Shivani Bhardwaj
2015-09-30 1:59 ` Greg KH [this message]
[not found] ` <CAKHNQQFAUaJfbySZ_r-ZtFAz9B7ih0Vmezgz3Qv7-khTB-2WYA@mail.gmail.com>
[not found] ` <20150930041851.GA21970@kroah.com>
2015-09-30 4:20 ` [Outreachy kernel] " Shivani Bhardwaj
2015-09-30 4:26 ` Shivani Bhardwaj
2015-09-30 4:42 ` Vaishali Thakkar
2015-09-30 5:17 ` Greg KH
[not found] ` <alpine.DEB.2.02.1509300722250.1984@localhost6.localdomain6>
[not found] ` <CAKHNQQGYc70qjW3Cjm=JOAbR5a5E+6KsTufMSuG2xsrY-g8Tgg@mail.gmail.com>
2015-09-30 18:05 ` Shivani Bhardwaj
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=20150930015931.GA14259@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=shivanib134@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.