Staging: iio: meter: Remove explicit NULL comparison
authorCristina Opriceana <cristina.opriceana@gmail.com>
Tue, 31 Mar 2015 10:01:18 +0000 (13:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2015 15:23:20 +0000 (17:23 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/meter/ade7758_core.c
drivers/staging/iio/meter/ade7758_ring.c
drivers/staging/iio/meter/ade7758_trigger.c

index 652aa1069b066e88227fd3e47450c99027cdfc38..77141ae1349dfdb9e359d1976254ddc351b110a6 100644 (file)
@@ -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;
        }
index ead38a50b25b9aac0baa6c61152766c3adac69db..9a24e0226f8baba43153801fae7df9292b266a1d 100644 (file)
@@ -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;
        }
index 6f45ce0478d760bd80aee3f2551ee12a7af2be76..5b35a7f08f4f7588803b1255d4c7748a11b6ed84 100644 (file)
@@ -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;
        }