Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1490913
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 7/7] iio: Adjust checks for null pointers in six functions |
| Date | 2016-09-25 16:30 +0200 |
| Message-ID | <sliBj-7JC-5@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <skODf-5Wa-3@gated-at.bofh.it> <skOMV-5Zi-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 24/09/16 07:31, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 24 Sep 2016 08:00:07 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script "checkpatch.pl" can point information out like the following.
>
> Comparison to NULL could be written !…
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
This is a more worthwhile change in my mind to the jump label changes.
Would you mind resending with it not based on top of those?
Thanks,
Jonathan
> ---
> drivers/iio/industrialio-buffer.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index 57e201a..6893639 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -310,7 +310,7 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
> trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength),
> sizeof(*trialmask),
> GFP_KERNEL);
> - if (trialmask == NULL)
> + if (!trialmask)
> return -ENOMEM;
> if (!indio_dev->masklength) {
> WARN(1, "Trying to set scanmask prior to registering buffer\n");
> @@ -711,7 +711,7 @@ static int iio_verify_update(struct iio_dev *indio_dev,
> /* What scan mask do we actually have? */
> compound_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
> sizeof(long), GFP_KERNEL);
> - if (compound_mask == NULL)
> + if (!compound_mask)
> return -ENOMEM;
>
> scan_timestamp = false;
> @@ -736,7 +736,7 @@ static int iio_verify_update(struct iio_dev *indio_dev,
> compound_mask,
> strict_scanmask);
> kfree(compound_mask);
> - if (scan_mask == NULL)
> + if (!scan_mask)
> return -EINVAL;
> } else {
> scan_mask = compound_mask;
> @@ -940,7 +940,7 @@ int iio_update_buffers(struct iio_dev *indio_dev,
> goto out_unlock;
> }
>
> - if (indio_dev->info == NULL) {
> + if (!indio_dev->info) {
> ret = -ENODEV;
> goto out_unlock;
> }
> @@ -1130,11 +1130,11 @@ int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
> indio_dev->scan_index_timestamp =
> channels[i].scan_index;
> }
> - if (indio_dev->masklength && buffer->scan_mask == NULL) {
> + if (indio_dev->masklength && !buffer->scan_mask) {
> buffer->scan_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
> sizeof(*buffer->scan_mask),
> GFP_KERNEL);
> - if (buffer->scan_mask == NULL) {
> + if (!buffer->scan_mask) {
> ret = -ENOMEM;
> goto error_cleanup_dynamic;
> }
> @@ -1146,7 +1146,7 @@ int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
> buffer->scan_el_group.attrs = kcalloc(attrcount + 1,
> sizeof(buffer->scan_el_group.attrs[0]),
> GFP_KERNEL);
> - if (buffer->scan_el_group.attrs == NULL) {
> + if (!buffer->scan_el_group.attrs) {
> ret = -ENOMEM;
> goto error_free_scan_mask;
> }
> @@ -1291,7 +1291,7 @@ static int iio_buffer_add_demux(struct iio_buffer *buffer,
> (*p)->length += length;
> } else {
> *p = kmalloc(sizeof(**p), GFP_KERNEL);
> - if (*p == NULL)
> + if (!*p)
> return -ENOMEM;
> (*p)->from = in_loc;
> (*p)->to = out_loc;
> @@ -1356,7 +1356,7 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev,
> in_loc += length;
> }
> buffer->demux_bounce = kzalloc(out_loc, GFP_KERNEL);
> - if (buffer->demux_bounce == NULL) {
> + if (!buffer->demux_bounce) {
> ret = -ENOMEM;
> goto error_clear_mux_table;
> }
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/7] iio: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 08:30 +0200
[PATCH 4/7] iio: Rename a jump label in iio_buffer_write_length() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 08:30 +0200
[PATCH 3/7] iio: Rename a jump label in iio_buffer_store_enable() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 08:30 +0200
[PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 08:30 +0200
Re: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set() Jonathan Cameron <jic23@kernel.org> - 2016-09-24 17:40 +0200
Re: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 18:20 +0200
Re: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set() Jonathan Cameron <jic23@kernel.org> - 2016-09-24 18:40 +0200
[PATCH 5/7] iio: Rename a jump label in iio_scan_el_ts_store() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 08:30 +0200
[PATCH 6/7] iio: Rename a jump label in iio_scan_el_store() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 08:40 +0200
[PATCH 7/7] iio: Adjust checks for null pointers in six functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-24 08:40 +0200
Re: [PATCH 7/7] iio: Adjust checks for null pointers in six functions Jonathan Cameron <jic23@kernel.org> - 2016-09-25 16:30 +0200
Re: iio: Adjust checks for null pointers in six functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-25 16:50 +0200
Re: iio: Adjust checks for null pointers in six functions Jonathan Cameron <jic23@kernel.org> - 2016-09-25 19:00 +0200
Re: iio: Adjust checks for null pointers in six functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-25 19:50 +0200
Re: iio: Adjust checks for null pointers in six functions Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-25 20:20 +0200
Re: iio: Adjust checks for null pointers in six functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-25 21:40 +0200
csiph-web