Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1490568 > unrolled thread

[PATCH 0/7] iio: Fine-tuning for several function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-09-24 08:30 +0200
Last post2016-09-25 21:40 +0200
Articles 16 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [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

#1490568 — [PATCH 0/7] iio: Fine-tuning for several function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 08:30 +0200
Subject[PATCH 0/7] iio: Fine-tuning for several function implementations
Message-ID<skODf-5Wa-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 24 Sep 2016 08:10:08 +0200

Some update suggestions were taken into account
from static source code analysis.

Markus Elfring (7):
  Use kmalloc_array() in iio_scan_mask_set()
  Rename a jump label in iio_buffer_store_watermark()
  Rename a jump label in iio_buffer_store_enable()
  Rename a jump label in iio_buffer_write_length()
  Rename a jump label in iio_scan_el_ts_store()
  Rename a jump label in iio_scan_el_store()
  Adjust checks for null pointers in six functions

 drivers/iio/industrialio-buffer.c | 55 ++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 29 deletions(-)

-- 
2.10.0

[toc] | [next] | [standalone]


#1490569 — [PATCH 4/7] iio: Rename a jump label in iio_buffer_write_length()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 08:30 +0200
Subject[PATCH 4/7] iio: Rename a jump label in iio_buffer_write_length()
Message-ID<skODg-5Wa-13@gated-at.bofh.it>
In reply to#1490568
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 24 Sep 2016 07:17:44 +0200

Adjust a jump label according to the current Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/industrialio-buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 6509f0f..376101f 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -505,10 +505,10 @@ static ssize_t iio_buffer_write_length(struct device *dev,
 		ret = 0;
 	}
 	if (ret)
-		goto out;
+		goto unlock;
 	if (buffer->length && buffer->length < buffer->watermark)
 		buffer->watermark = buffer->length;
-out:
+unlock:
 	mutex_unlock(&indio_dev->mlock);
 
 	return ret ? ret : len;
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1490570 — [PATCH 3/7] iio: Rename a jump label in iio_buffer_store_enable()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 08:30 +0200
Subject[PATCH 3/7] iio: Rename a jump label in iio_buffer_store_enable()
Message-ID<skODg-5Wa-17@gated-at.bofh.it>
In reply to#1490568
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 24 Sep 2016 07:11:32 +0200

Adjust a jump label according to the current Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/industrialio-buffer.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index a865af8..6509f0f 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -982,7 +982,7 @@ static ssize_t iio_buffer_store_enable(struct device *dev,
 	inlist = iio_buffer_is_active(indio_dev->buffer);
 	/* Already in desired state */
 	if (inlist == requested_state)
-		goto done;
+		goto unlock;
 
 	if (requested_state)
 		ret = __iio_update_buffers(indio_dev,
@@ -990,8 +990,7 @@ static ssize_t iio_buffer_store_enable(struct device *dev,
 	else
 		ret = __iio_update_buffers(indio_dev,
 					 NULL, indio_dev->buffer);
-
-done:
+unlock:
 	mutex_unlock(&indio_dev->mlock);
 	return (ret < 0) ? ret : len;
 }
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1490571 — [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 08:30 +0200
Subject[PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()
Message-ID<skODg-5Wa-19@gated-at.bofh.it>
In reply to#1490568
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 23 Sep 2016 22:30:32 +0200

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/industrialio-buffer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 49bf9c5..7a4d9499 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -307,10 +307,9 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
 	const unsigned long *mask;
 	unsigned long *trialmask;
 
-	trialmask = kmalloc(sizeof(*trialmask)*
-			    BITS_TO_LONGS(indio_dev->masklength),
-			    GFP_KERNEL);
-
+	trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength),
+				  sizeof(*trialmask),
+				  GFP_KERNEL);
 	if (trialmask == NULL)
 		return -ENOMEM;
 	if (!indio_dev->masklength) {
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1490668 — Re: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()

FromJonathan Cameron <jic23@kernel.org>
Date2016-09-24 17:40 +0200
SubjectRe: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()
Message-ID<skXdv-2Iz-17@gated-at.bofh.it>
In reply to#1490571
On 24/09/16 07:24, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 23 Sep 2016 22:30:32 +0200
> 
> A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied to the togreg branch of iio.git - initially pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/industrialio-buffer.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index 49bf9c5..7a4d9499 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -307,10 +307,9 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
>  	const unsigned long *mask;
>  	unsigned long *trialmask;
>  
> -	trialmask = kmalloc(sizeof(*trialmask)*
> -			    BITS_TO_LONGS(indio_dev->masklength),
> -			    GFP_KERNEL);
> -
> +	trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength),
> +				  sizeof(*trialmask),
> +				  GFP_KERNEL);
>  	if (trialmask == NULL)
>  		return -ENOMEM;
>  	if (!indio_dev->masklength) {
> 

[toc] | [prev] | [next] | [standalone]


#1490672 — Re: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 18:20 +0200
SubjectRe: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()
Message-ID<skXQd-3em-1@gated-at.bofh.it>
In reply to#1490668
> Applied to the togreg branch of iio.git - initially pushed out
> as testing for the autobuilders to play with it.

Thanks for your positive response.


Do you see any need to improve the software situation around
the macro "BITS_TO_LONGS" further?

Do you fiddle with a programming interface like "bitmap_alloc" occasionally?

Regards,
Markus

[toc] | [prev] | [next] | [standalone]


#1490679 — Re: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()

FromJonathan Cameron <jic23@kernel.org>
Date2016-09-24 18:40 +0200
SubjectRe: [PATCH 1/7] iio: Use kmalloc_array() in iio_scan_mask_set()
Message-ID<skY9A-3kN-15@gated-at.bofh.it>
In reply to#1490672
On 24/09/16 17:18, SF Markus Elfring wrote:
>> Applied to the togreg branch of iio.git - initially pushed out
>> as testing for the autobuilders to play with it.
> 
> Thanks for your positive response.
> 
> 
> Do you see any need to improve the software situation around
> the macro "BITS_TO_LONGS" further?
> 
> Do you fiddle with a programming interface like "bitmap_alloc" occasionally?
It might be clearer than having an array allocation as we do after this
patch. Obviously the representation is an array, but it is a little ugly
as it stands!
> 
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1490572 — [PATCH 5/7] iio: Rename a jump label in iio_scan_el_ts_store()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 08:30 +0200
Subject[PATCH 5/7] iio: Rename a jump label in iio_scan_el_ts_store()
Message-ID<skODg-5Wa-21@gated-at.bofh.it>
In reply to#1490568
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 24 Sep 2016 07:27:26 +0200

Adjust a jump label according to the current Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/industrialio-buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 376101f..4b8f313 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -409,10 +409,10 @@ static ssize_t iio_scan_el_ts_store(struct device *dev,
 	mutex_lock(&indio_dev->mlock);
 	if (iio_buffer_is_active(indio_dev->buffer)) {
 		ret = -EBUSY;
-		goto error_ret;
+		goto unlock;
 	}
 	indio_dev->buffer->scan_timestamp = state;
-error_ret:
+unlock:
 	mutex_unlock(&indio_dev->mlock);
 
 	return ret ? ret : len;
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1490573 — [PATCH 6/7] iio: Rename a jump label in iio_scan_el_store()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 08:40 +0200
Subject[PATCH 6/7] iio: Rename a jump label in iio_scan_el_store()
Message-ID<skOMV-5Zi-3@gated-at.bofh.it>
In reply to#1490568
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 24 Sep 2016 07:40:59 +0200

Adjust jump labels according to the current Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/industrialio-buffer.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 4b8f313..57e201a 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -363,22 +363,21 @@ static ssize_t iio_scan_el_store(struct device *dev,
 	mutex_lock(&indio_dev->mlock);
 	if (iio_buffer_is_active(indio_dev->buffer)) {
 		ret = -EBUSY;
-		goto error_ret;
+		goto unlock;
 	}
 	ret = iio_scan_mask_query(indio_dev, buffer, this_attr->address);
 	if (ret < 0)
-		goto error_ret;
+		goto unlock;
 	if (!state && ret) {
 		ret = iio_scan_mask_clear(buffer, this_attr->address);
 		if (ret)
-			goto error_ret;
+			goto unlock;
 	} else if (state && !ret) {
 		ret = iio_scan_mask_set(indio_dev, buffer, this_attr->address);
 		if (ret)
-			goto error_ret;
+			goto unlock;
 	}
-
-error_ret:
+unlock:
 	mutex_unlock(&indio_dev->mlock);
 
 	return ret < 0 ? ret : len;
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1490574 — [PATCH 7/7] iio: Adjust checks for null pointers in six functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-24 08:40 +0200
Subject[PATCH 7/7] iio: Adjust checks for null pointers in six functions
Message-ID<skOMV-5Zi-9@gated-at.bofh.it>
In reply to#1490568
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>
---
 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;
 	}
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1490913 — Re: [PATCH 7/7] iio: Adjust checks for null pointers in six functions

FromJonathan Cameron <jic23@kernel.org>
Date2016-09-25 16:30 +0200
SubjectRe: [PATCH 7/7] iio: Adjust checks for null pointers in six functions
Message-ID<sliBj-7JC-5@gated-at.bofh.it>
In reply to#1490574
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;
>  	}
> 

[toc] | [prev] | [next] | [standalone]


#1490917 — Re: iio: Adjust checks for null pointers in six functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-25 16:50 +0200
SubjectRe: iio: Adjust checks for null pointers in six functions
Message-ID<sliUG-7Q2-21@gated-at.bofh.it>
In reply to#1490913
> This is a more worthwhile change in my mind to the jump label changes.

Thanks for another bit of positive feedback for this refactoring.


> Would you mind resending with it not based on top of those?

Is a resend really needed?

Does the tool "Git" let you also apply this update step before
the other suggestions?

Would you dare a reordering of items according to your change preferences?

Regards,
Markus

[toc] | [prev] | [next] | [standalone]


#1490935 — Re: iio: Adjust checks for null pointers in six functions

FromJonathan Cameron <jic23@kernel.org>
Date2016-09-25 19:00 +0200
SubjectRe: iio: Adjust checks for null pointers in six functions
Message-ID<slkWu-BO-45@gated-at.bofh.it>
In reply to#1490917
On 25/09/16 15:44, SF Markus Elfring wrote:
>> This is a more worthwhile change in my mind to the jump label changes.
> 
> Thanks for another bit of positive feedback for this refactoring.
> 
> 
>> Would you mind resending with it not based on top of those?
> 
> Is a resend really needed?
It's a question of time.  Maintainers regularly push back stuff
they could fix up themselves purely to save their time.

Also, I'm afraid I don't care enough to put the time in for this
one.  I care enough to review / apply the patch though.
> 
> Does the tool "Git" let you also apply this update step before
> the other suggestions?
It rarely copes with this sort of reordering as it doesn't have
the semantic knowledge of what matters in the other patches.
> 
> Would you dare a reordering of items according to your change preferences?
> 
> Regards,
> Markus
> 

[toc] | [prev] | [next] | [standalone]


#1490941 — Re: iio: Adjust checks for null pointers in six functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-25 19:50 +0200
SubjectRe: iio: Adjust checks for null pointers in six functions
Message-ID<sllIR-16X-1@gated-at.bofh.it>
In reply to#1490935
> Also, I'm afraid I don't care enough to put the time in for this one.

It's a pity.


>> Does the tool "Git" let you also apply this update step before
>> the other suggestions?
> It rarely copes with this sort of reordering as it doesn't have
> the semantic knowledge of what matters in the other patches.

I assume that the involved software developers got a specific impression
about the discussed patch series for this software module so that a few
relevant dependencies became clearer eventually.

I proposed some update steps where I chose a specific patch granularity
once more. So I imagine that a bit of variation in the patch order
could be supported already.

Will it be possible to apply also this one a bit later just because
the patch hunk contexts might be still valid in the (near) future?

Regards,
Markus

[toc] | [prev] | [next] | [standalone]


#1490945 — Re: iio: Adjust checks for null pointers in six functions

FromAl Viro <viro@ZenIV.linux.org.uk>
Date2016-09-25 20:20 +0200
SubjectRe: iio: Adjust checks for null pointers in six functions
Message-ID<slmbU-1z2-13@gated-at.bofh.it>
In reply to#1490941
On Sun, Sep 25, 2016 at 07:45:40PM +0200, SF Markus Elfring wrote:

> I assume that the involved software developers got a specific impression
> about the discussed patch series for this software module so that a few
> relevant dependencies became clearer eventually.
> 
> I proposed some update steps where I chose a specific patch granularity
> once more. So I imagine that a bit of variation in the patch order
> could be supported already.
> 
> Will it be possible to apply also this one a bit later just because
> the patch hunk contexts might be still valid in the (near) future?

I wonder if you realize that your postings _reek_ with the Strong Programme
intellectual offal...  Are you, by any chance, some kind of sociology grad?
You can't study development purely on the process level, ignoring the actual
usefulness of contributions and the fact that there are objective criteria
of their worth.

[toc] | [prev] | [next] | [standalone]


#1490958 — Re: iio: Adjust checks for null pointers in six functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-09-25 21:40 +0200
SubjectRe: iio: Adjust checks for null pointers in six functions
Message-ID<slnrj-2dL-7@gated-at.bofh.it>
In reply to#1490945
> Are you, by any chance, some kind of sociology grad?

Not yet. ;-)   - It looks also unlikely at the moment that my life will evolve
in such direction.


> You can't study development purely on the process level,

I find that I am not studying this topic. Am I practically contributing
small improvements to free software (including Linux) for years?


> ignoring the actual usefulness of contributions

I guess their usefulness is varying over time.


> and the fact that there are objective criteria of their worth.

Are there any source code quality goals left over which would be nice
to achieve also for this software module?

Regards,
Markus

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web