linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: manish.narani@xilinx.com (Manish Narani)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] iio: adc: xilinx: Rename 'channels' variable name to 'iio_xadc_channels'
Date: Wed, 18 Jul 2018 16:42:08 +0530	[thread overview]
Message-ID: <1531912331-26431-2-git-send-email-manish.narani@xilinx.com> (raw)
In-Reply-To: <1531912331-26431-1-git-send-email-manish.narani@xilinx.com>

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.

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;
 }
-- 
2.1.1

  reply	other threads:[~2018-07-18 11:12 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 ` Manish Narani [this message]
2018-07-18 11:18   ` [PATCH 1/4] iio: adc: xilinx: Rename 'channels' variable name to 'iio_xadc_channels' Lars-Peter Clausen
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=1531912331-26431-2-git-send-email-manish.narani@xilinx.com \
    --to=manish.narani@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).