All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison
@ 2015-03-31  9:49 Cristina Opriceana
  2015-03-31  9:51 ` [PATCH v2 1/7] Staging: iio: iio_dummy_evgen: Simplify " Cristina Opriceana
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31  9:49 UTC (permalink / raw)
  To: outreachy-kernel

This patchset removes explicit NULL comparison from the iio drivers.
Changes in v2:
  - add explicit tag for each commit message to identify better the
  drivers to which the changes belong.

Cristina Opriceana (7):
  Staging: iio: iio_dummy_evgen: Simplify NULL comparison
  Staging: iio: iio_simple_dummy: Remove explicit NULL comparison
  Staging: iio: meter: Remove explicit NULL comparison
  Staging: iio: trigger: Remove explicit NULL comparison
  Staging: iio: impedance-analyzer: Remove explicit NULL comparison
  Staging: iio: adc: Remove explicit NULL comparison
  Staging: iio: accel: Remove explicit NULL comparison

 drivers/staging/iio/accel/lis3l02dq_ring.c          | 6 +++---
 drivers/staging/iio/adc/ad7606_ring.c               | 2 +-
 drivers/staging/iio/adc/ad7780.c                    | 2 +-
 drivers/staging/iio/iio_dummy_evgen.c               | 4 ++--
 drivers/staging/iio/iio_simple_dummy.c              | 2 +-
 drivers/staging/iio/iio_simple_dummy_buffer.c       | 6 +++---
 drivers/staging/iio/impedance-analyzer/ad5933.c     | 2 +-
 drivers/staging/iio/meter/ade7758_core.c            | 2 +-
 drivers/staging/iio/meter/ade7758_ring.c            | 2 +-
 drivers/staging/iio/meter/ade7758_trigger.c         | 2 +-
 drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 4 ++--
 11 files changed, 17 insertions(+), 17 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/7] Staging: iio: iio_dummy_evgen: Simplify NULL comparison
  2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
@ 2015-03-31  9:51 ` Cristina Opriceana
  2015-03-31  9:51 ` [PATCH v2 2/7] Staging: iio: iio_simple_dummy: Remove explicit " Cristina Opriceana
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31  9:51 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

Remove explicit NULL comparison and write it in its simpler form.
Replacement done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/iio_dummy_evgen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/iio_dummy_evgen.c b/drivers/staging/iio/iio_dummy_evgen.c
index 59ad5a3..0c9c86d 100644
--- a/drivers/staging/iio/iio_dummy_evgen.c
+++ b/drivers/staging/iio/iio_dummy_evgen.c
@@ -72,7 +72,7 @@ static int iio_dummy_evgen_create(void)
 	int ret, i;
 
 	iio_evgen = kzalloc(sizeof(*iio_evgen), GFP_KERNEL);
-	if (iio_evgen == NULL)
+	if (!iio_evgen)
 		return -ENOMEM;
 
 	iio_evgen->base = irq_alloc_descs(-1, 0, IIO_EVENTGEN_NO, 0);
@@ -105,7 +105,7 @@ int iio_dummy_evgen_get_irq(void)
 {
 	int i, ret = 0;
 
-	if (iio_evgen == NULL)
+	if (!iio_evgen)
 		return -ENODEV;
 
 	mutex_lock(&iio_evgen->lock);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/7] Staging: iio: iio_simple_dummy: Remove explicit NULL comparison
  2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
  2015-03-31  9:51 ` [PATCH v2 1/7] Staging: iio: iio_dummy_evgen: Simplify " Cristina Opriceana
@ 2015-03-31  9:51 ` Cristina Opriceana
  2015-03-31 10:01 ` [PATCH v2 3/7] Staging: iio: meter: " Cristina Opriceana
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31  9:51 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

This patch removes explicit NULL comparison and writes it in its
simpler form. Done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/iio_simple_dummy.c        | 2 +-
 drivers/staging/iio/iio_simple_dummy_buffer.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index 8341dce..b47bf9f 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -588,7 +588,7 @@ static int iio_dummy_probe(int index)
 	 * for chip specific state information.
 	 */
 	indio_dev = iio_device_alloc(sizeof(*st));
-	if (indio_dev == NULL) {
+	if (!indio_dev) {
 		ret = -ENOMEM;
 		goto error_ret;
 	}
diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c
index 360a4c9..a651b89 100644
--- a/drivers/staging/iio/iio_simple_dummy_buffer.c
+++ b/drivers/staging/iio/iio_simple_dummy_buffer.c
@@ -50,7 +50,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
 	u16 *data;
 
 	data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
-	if (data == NULL)
+	if (!data)
 		goto done;
 
 	if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) {
@@ -122,7 +122,7 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev)
 
 	/* Allocate a buffer to use - here a kfifo */
 	buffer = iio_kfifo_allocate();
-	if (buffer == NULL) {
+	if (!buffer) {
 		ret = -ENOMEM;
 		goto error_ret;
 	}
@@ -161,7 +161,7 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev)
 						 "iio_simple_dummy_consumer%d",
 						 indio_dev->id);
 
-	if (indio_dev->pollfunc == NULL) {
+	if (!indio_dev->pollfunc) {
 		ret = -ENOMEM;
 		goto error_free_buffer;
 	}
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/7] Staging: iio: meter: Remove explicit NULL comparison
  2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
  2015-03-31  9:51 ` [PATCH v2 1/7] Staging: iio: iio_dummy_evgen: Simplify " Cristina Opriceana
  2015-03-31  9:51 ` [PATCH v2 2/7] Staging: iio: iio_simple_dummy: Remove explicit " Cristina Opriceana
@ 2015-03-31 10:01 ` Cristina Opriceana
  2015-03-31 10:03 ` [PATCH v2 4/7] Staging: iio: trigger: " Cristina Opriceana
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31 10:01 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

This patch removes explicit NULL comparison and replaces it with
its shorter form. Detected with coccinelle.

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/meter/ade7758_core.c    | 2 +-
 drivers/staging/iio/meter/ade7758_ring.c    | 2 +-
 drivers/staging/iio/meter/ade7758_trigger.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 652aa10..77141ae 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -833,7 +833,7 @@ static int ade7758_probe(struct spi_device *spi)
 	if (!st->rx)
 		return -ENOMEM;
 	st->tx = kcalloc(ADE7758_MAX_TX, sizeof(*st->tx), GFP_KERNEL);
-	if (st->tx == NULL) {
+	if (!st->tx) {
 		ret = -ENOMEM;
 		goto error_free_rx;
 	}
diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c
index ead38a5..9a24e02 100644
--- a/drivers/staging/iio/meter/ade7758_ring.c
+++ b/drivers/staging/iio/meter/ade7758_ring.c
@@ -132,7 +132,7 @@ int ade7758_configure_ring(struct iio_dev *indio_dev)
 						 indio_dev,
 						 "ade7759_consumer%d",
 						 indio_dev->id);
-	if (indio_dev->pollfunc == NULL) {
+	if (!indio_dev->pollfunc) {
 		ret = -ENOMEM;
 		goto error_iio_kfifo_free;
 	}
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c
index 6f45ce0..5b35a7f 100644
--- a/drivers/staging/iio/meter/ade7758_trigger.c
+++ b/drivers/staging/iio/meter/ade7758_trigger.c
@@ -66,7 +66,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
 	st->trig = iio_trigger_alloc("%s-dev%d",
 					spi_get_device_id(st->us)->name,
 					indio_dev->id);
-	if (st->trig == NULL) {
+	if (!st->trig) {
 		ret = -ENOMEM;
 		goto error_ret;
 	}
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/7] Staging: iio: trigger: Remove explicit NULL comparison
  2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
                   ` (2 preceding siblings ...)
  2015-03-31 10:01 ` [PATCH v2 3/7] Staging: iio: meter: " Cristina Opriceana
@ 2015-03-31 10:03 ` Cristina Opriceana
  2015-03-31 10:03 ` [PATCH v2 5/7] Staging: iio: impedance-analyzer: " Cristina Opriceana
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31 10:03 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

This patch removes explicit NULL comparison and replaces it
with its shorter form. Detected with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
index 89df1d3..0c1976d 100644
--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -124,7 +124,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
 	int i, ret;
 
 	for (i = 0;; i++) {
-		if (pdata[i] == NULL)
+		if (!pdata[i])
 			break;
 		trig = iio_trigger_alloc("periodic%s", pdata[i]);
 		if (!trig) {
@@ -142,7 +142,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
 		trig->ops = &iio_prtc_trigger_ops;
 		/* RTC access */
 		trig_info->rtc = rtc_class_open(pdata[i]);
-		if (trig_info->rtc == NULL) {
+		if (!trig_info->rtc) {
 			ret = -EINVAL;
 			goto error_free_trig_info;
 		}
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 5/7] Staging: iio: impedance-analyzer: Remove explicit NULL comparison
  2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
                   ` (3 preceding siblings ...)
  2015-03-31 10:03 ` [PATCH v2 4/7] Staging: iio: trigger: " Cristina Opriceana
@ 2015-03-31 10:03 ` Cristina Opriceana
  2015-03-31 10:04 ` [PATCH v2 6/7] Staging: iio: adc: " Cristina Opriceana
  2015-03-31 10:04 ` [PATCH v2 7/7] Staging: iio: accel: " Cristina Opriceana
  6 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31 10:03 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

This patch removes explicit NULL comparison and replaces it with
its shorter form. Detected with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 7919439..c18109c 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -703,7 +703,7 @@ static int ad5933_probe(struct i2c_client *client,
 	struct iio_dev *indio_dev;
 
 	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st));
-	if (indio_dev == NULL)
+	if (!indio_dev)
 		return -ENOMEM;
 
 	st = iio_priv(indio_dev);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 6/7] Staging: iio: adc: Remove explicit NULL comparison
  2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
                   ` (4 preceding siblings ...)
  2015-03-31 10:03 ` [PATCH v2 5/7] Staging: iio: impedance-analyzer: " Cristina Opriceana
@ 2015-03-31 10:04 ` Cristina Opriceana
  2015-03-31 10:04 ` [PATCH v2 7/7] Staging: iio: accel: " Cristina Opriceana
  6 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31 10:04 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

This patch removes explicit NULL comparison and writes it in its
shorter form. Detected with coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/adc/ad7606_ring.c | 2 +-
 drivers/staging/iio/adc/ad7780.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7606_ring.c b/drivers/staging/iio/adc/ad7606_ring.c
index 3bf174c..a6f8eb1 100644
--- a/drivers/staging/iio/adc/ad7606_ring.c
+++ b/drivers/staging/iio/adc/ad7606_ring.c
@@ -50,7 +50,7 @@ static void ad7606_poll_bh_to_ring(struct work_struct *work_s)
 	int ret;
 
 	buf = kzalloc(indio_dev->scan_bytes, GFP_KERNEL);
-	if (buf == NULL)
+	if (!buf)
 		return;
 
 	if (gpio_is_valid(st->pdata->gpio_frstdata)) {
diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
index 273add3..6cb17ec 100644
--- a/drivers/staging/iio/adc/ad7780.c
+++ b/drivers/staging/iio/adc/ad7780.c
@@ -169,7 +169,7 @@ static int ad7780_probe(struct spi_device *spi)
 	int ret, voltage_uv = 0;
 
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
-	if (indio_dev == NULL)
+	if (!indio_dev)
 		return -ENOMEM;
 
 	st = iio_priv(indio_dev);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 7/7] Staging: iio: accel: Remove explicit NULL comparison
  2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
                   ` (5 preceding siblings ...)
  2015-03-31 10:04 ` [PATCH v2 6/7] Staging: iio: adc: " Cristina Opriceana
@ 2015-03-31 10:04 ` Cristina Opriceana
  6 siblings, 0 replies; 8+ messages in thread
From: Cristina Opriceana @ 2015-03-31 10:04 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: outreachy-kernel

This patch removes explicit NULL comparison and writes it in its
equivalent shorter form. Done with coccinelle.

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/staging/iio/accel/lis3l02dq_ring.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index e6101bb..677774f 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -119,7 +119,7 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev,
 				       indio_dev->masklength);
 
 	rx_array = kcalloc(4, scan_count, GFP_KERNEL);
-	if (rx_array == NULL)
+	if (!rx_array)
 		return -ENOMEM;
 	ret = lis3l02dq_read_all(indio_dev, rx_array);
 	if (ret < 0) {
@@ -142,7 +142,7 @@ static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p)
 	char *data;
 
 	data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
-	if (data == NULL)
+	if (!data)
 		goto done;
 
 	if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
@@ -410,7 +410,7 @@ int lis3l02dq_configure_buffer(struct iio_dev *indio_dev)
 						 "lis3l02dq_consumer%d",
 						 indio_dev->id);
 
-	if (indio_dev->pollfunc == NULL) {
+	if (!indio_dev->pollfunc) {
 		ret = -ENOMEM;
 		goto error_iio_sw_rb_free;
 	}
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-31 10:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31  9:49 [PATCH v2 0/7] Staging: iio: Remove explicit NULL comparison Cristina Opriceana
2015-03-31  9:51 ` [PATCH v2 1/7] Staging: iio: iio_dummy_evgen: Simplify " Cristina Opriceana
2015-03-31  9:51 ` [PATCH v2 2/7] Staging: iio: iio_simple_dummy: Remove explicit " Cristina Opriceana
2015-03-31 10:01 ` [PATCH v2 3/7] Staging: iio: meter: " Cristina Opriceana
2015-03-31 10:03 ` [PATCH v2 4/7] Staging: iio: trigger: " Cristina Opriceana
2015-03-31 10:03 ` [PATCH v2 5/7] Staging: iio: impedance-analyzer: " Cristina Opriceana
2015-03-31 10:04 ` [PATCH v2 6/7] Staging: iio: adc: " Cristina Opriceana
2015-03-31 10:04 ` [PATCH v2 7/7] Staging: iio: accel: " Cristina Opriceana

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.