From: Lars-Peter Clausen <lars@metafoo.de>
To: Manish Narani <manish.narani@xilinx.com>,
jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net,
michal.simek@xilinx.com, linux-iio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: anirudh@xilinx.com, sgoud@xilinx.com, Joe Perches <joe@perches.com>
Subject: Re: [PATCH 1/4] iio: adc: xilinx: Rename 'channels' variable name to 'iio_xadc_channels'
Date: Wed, 18 Jul 2018 13:18:34 +0200 [thread overview]
Message-ID: <d2c3ddfd-91da-e500-7b58-917d2da1d540@metafoo.de> (raw)
In-Reply-To: <1531912331-26431-2-git-send-email-manish.narani@xilinx.com>
On 07/18/2018 01:12 PM, Manish Narani wrote:
> This patch fix the following checkpatch warning in xadc driver.
> - Reusing the krealloc arg is almost always a bug.
>
> Renamed the 'channels' variable as 'iio_xadc_channels' to fix the above
> warning.
>
This is a bug in checkpatch and should be fixed in checkpatch. The code is
not actually re-using the parameter. channels and xadc_channels are
independent variables, just checkpatch somehow does not realize this.
> Signed-off-by: Manish Narani <manish.narani@xilinx.com>
> ---
> drivers/iio/adc/xilinx-xadc-core.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index d4f21d1..27b45df 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -1040,7 +1040,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
> unsigned int *conf)
> {
> struct xadc *xadc = iio_priv(indio_dev);
> - struct iio_chan_spec *channels, *chan;
> + struct iio_chan_spec *iio_xadc_channels, *chan;
> struct device_node *chan_node, *child;
> unsigned int num_channels;
> const char *external_mux;
> @@ -1083,12 +1083,13 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
> *conf |= XADC_CONF0_MUX | XADC_CONF0_CHAN(ext_mux_chan);
> }
>
> - channels = kmemdup(xadc_channels, sizeof(xadc_channels), GFP_KERNEL);
> - if (!channels)
> + iio_xadc_channels = kmemdup(xadc_channels, sizeof(xadc_channels),
> + GFP_KERNEL);
> + if (!iio_xadc_channels)
> return -ENOMEM;
>
> num_channels = 9;
> - chan = &channels[9];
> + chan = &iio_xadc_channels[9];
>
> chan_node = of_get_child_by_name(np, "xlnx,channels");
> if (chan_node) {
> @@ -1119,11 +1120,12 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
> of_node_put(chan_node);
>
> indio_dev->num_channels = num_channels;
> - indio_dev->channels = krealloc(channels, sizeof(*channels) *
> - num_channels, GFP_KERNEL);
> + indio_dev->channels = krealloc(iio_xadc_channels,
> + sizeof(*iio_xadc_channels) *
> + num_channels, GFP_KERNEL);
> /* If we can't resize the channels array, just use the original */
> if (!indio_dev->channels)
> - indio_dev->channels = channels;
> + indio_dev->channels = iio_xadc_channels;
>
> return 0;
> }
>
next prev parent reply other threads:[~2018-07-18 11:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 11:12 [PATCH 0/4] iio: adc: xilinx: XADC driver enhancements and bug fixes Manish Narani
2018-07-18 11:12 ` [PATCH 1/4] iio: adc: xilinx: Rename 'channels' variable name to 'iio_xadc_channels' Manish Narani
2018-07-18 11:18 ` Lars-Peter Clausen [this message]
2018-07-18 11:52 ` Manish Narani
2018-07-19 8:22 ` Michal Simek
2018-07-21 16:18 ` Jonathan Cameron
2018-07-21 16:22 ` Joe Perches
2018-07-21 16:33 ` Jonathan Cameron
2018-07-18 11:12 ` [PATCH 2/4] iio: adc: xilinx: Remove dead code from xadc_zynq_setup Manish Narani
2018-07-21 16:22 ` Jonathan Cameron
2018-07-18 11:12 ` [PATCH 3/4] iio: adc: xilinx: Check for return values in clk related functions Manish Narani
2018-07-19 16:40 ` Lars-Peter Clausen
2018-07-21 16:24 ` Jonathan Cameron
2018-07-23 9:34 ` Manish Narani
2018-07-18 11:12 ` [PATCH 4/4] iio: adc: xilinx: Use devm_ functions while requesting irq Manish Narani
2018-07-19 16:37 ` Lars-Peter Clausen
2018-07-23 9:27 ` Manish Narani
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=d2c3ddfd-91da-e500-7b58-917d2da1d540@metafoo.de \
--to=lars@metafoo.de \
--cc=anirudh@xilinx.com \
--cc=jic23@kernel.org \
--cc=joe@perches.com \
--cc=knaack.h@gmx.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manish.narani@xilinx.com \
--cc=michal.simek@xilinx.com \
--cc=pmeerw@pmeerw.net \
--cc=sgoud@xilinx.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;
as well as URLs for NNTP newsgroup(s).