From: Thierry Reding <thierry.reding@gmail.com>
To: "Manuel Schölling" <manuel.schoelling@gmx.de>
Cc: linus.walleij@linaro.org, swarren@wwwdotorg.org,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH] pinctrl: Cleanup string initializations (char[] instead of char *)
Date: Sat, 17 May 2014 23:24:22 +0200 [thread overview]
Message-ID: <20140517212421.GD1046@mithrandir> (raw)
In-Reply-To: <1400337445-25750-1-git-send-email-manuel.schoelling@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]
On Sat, May 17, 2014 at 04:37:25PM +0200, Manuel Schölling wrote:
[...]
> diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
> index 6545809..43eeb1b 100644
> --- a/drivers/pinctrl/pinctrl-tegra.c
> +++ b/drivers/pinctrl/pinctrl-tegra.c
> @@ -576,7 +576,7 @@ static void tegra_pinconf_config_dbg_show(struct pinctrl_dev *pctldev,
> {
> enum tegra_pinconf_param param = TEGRA_PINCONF_UNPACK_PARAM(config);
> u16 arg = TEGRA_PINCONF_UNPACK_ARG(config);
> - const char *pname = "unknown";
> + const char pname[] = "unknown";
> int i;
>
> for (i = 0; i < ARRAY_SIZE(cfg_params); i++) {
When this hunk is applied, the build fails as follows:
CC drivers/pinctrl/pinctrl-tegra.o
drivers/pinctrl/pinctrl-tegra.c: In function 'tegra_pinconf_config_dbg_show':
drivers/pinctrl/pinctrl-tegra.c:589:4: warning: assignment of read-only location 'pname' [enabled by default]
pname = cfg_params[i].property;
^
drivers/pinctrl/pinctrl-tegra.c:589:10: error: incompatible types when assigning to type 'const char[8]' from type 'const char * const'
pname = cfg_params[i].property;
^
As you can see, pname is used to store a property name and the default
value is set to the static string "unknown" for cases where no matching
parameter is found in cfg_params. However, if a match is found the
default value will be overwritten, so you can't use const char [].
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-05-17 21:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-17 14:37 [PATCH] pinctrl: Cleanup string initializations (char[] instead of char *) Manuel Schölling
2014-05-17 21:24 ` Thierry Reding [this message]
2014-05-22 21:57 ` Linus Walleij
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=20140517212421.GD1046@mithrandir \
--to=thierry.reding@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=manuel.schoelling@gmx.de \
--cc=swarren@wwwdotorg.org \
/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