All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] S390-virtio: Adjustments for three function implementations
@ 2017-05-16 15:50 ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:50 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:43:21 +0200

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

Markus Elfring (3):
  Delete error messages for failed memory allocations in two functions
  Improve a size determination in virtio_ccw_setup_vq()
  Adjust a null pointer check in two functions

 drivers/s390/virtio/virtio_ccw.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

-- 
2.13.0

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

* [PATCH 0/3] S390-virtio: Adjustments for three function implementations
@ 2017-05-16 15:50 ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:50 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:43:21 +0200

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

Markus Elfring (3):
  Delete error messages for failed memory allocations in two functions
  Improve a size determination in virtio_ccw_setup_vq()
  Adjust a null pointer check in two functions

 drivers/s390/virtio/virtio_ccw.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

-- 
2.13.0


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

* [PATCH 1/3] s390: virtio: Delete error messages for failed memory allocations in two functions
  2017-05-16 15:50 ` SF Markus Elfring
@ 2017-05-16 15:51   ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:51 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors, Wolfram Sang

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 16:50:17 +0200

Omit three extra messages for memory allocation failures in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/s390/virtio/virtio_ccw.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 2a76ea78a0bf..447fe718c0ab 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -499,12 +499,10 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	if (!info) {
-		dev_warn(&vcdev->cdev->dev, "no info\n");
 		err = -ENOMEM;
 		goto out_err;
 	}
 	info->info_block = kzalloc(sizeof(*info->info_block),
 				   GFP_DMA | GFP_KERNEL);
 	if (!info->info_block) {
-		dev_warn(&vcdev->cdev->dev, "no info block\n");
 		err = -ENOMEM;
 		goto out_err;
 	}
@@ -1225,7 +1223,6 @@ static int virtio_ccw_online(struct ccw_device *cdev)
 
 	vcdev = kzalloc(sizeof(*vcdev), GFP_KERNEL);
 	if (!vcdev) {
-		dev_warn(&cdev->dev, "Could not get memory for virtio\n");
 		ret = -ENOMEM;
 		goto out_free;
 	}
-- 
2.13.0

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

* [PATCH 1/3] s390: virtio: Delete error messages for failed memory allocations in two functions
@ 2017-05-16 15:51   ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:51 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors, Wolfram Sang

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 16:50:17 +0200

Omit three extra messages for memory allocation failures in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/s390/virtio/virtio_ccw.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 2a76ea78a0bf..447fe718c0ab 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -499,12 +499,10 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	if (!info) {
-		dev_warn(&vcdev->cdev->dev, "no info\n");
 		err = -ENOMEM;
 		goto out_err;
 	}
 	info->info_block = kzalloc(sizeof(*info->info_block),
 				   GFP_DMA | GFP_KERNEL);
 	if (!info->info_block) {
-		dev_warn(&vcdev->cdev->dev, "no info block\n");
 		err = -ENOMEM;
 		goto out_err;
 	}
@@ -1225,7 +1223,6 @@ static int virtio_ccw_online(struct ccw_device *cdev)
 
 	vcdev = kzalloc(sizeof(*vcdev), GFP_KERNEL);
 	if (!vcdev) {
-		dev_warn(&cdev->dev, "Could not get memory for virtio\n");
 		ret = -ENOMEM;
 		goto out_free;
 	}
-- 
2.13.0


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

* [PATCH 1/3] s390: virtio: Delete error messages for failed memory allocations in two functions
  2017-05-16 15:50 ` SF Markus Elfring
  (?)
@ 2017-05-16 15:51 ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:51 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: kernel-janitors, LKML, Wolfram Sang

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 16:50:17 +0200

Omit three extra messages for memory allocation failures in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/s390/virtio/virtio_ccw.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 2a76ea78a0bf..447fe718c0ab 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -499,12 +499,10 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	if (!info) {
-		dev_warn(&vcdev->cdev->dev, "no info\n");
 		err = -ENOMEM;
 		goto out_err;
 	}
 	info->info_block = kzalloc(sizeof(*info->info_block),
 				   GFP_DMA | GFP_KERNEL);
 	if (!info->info_block) {
-		dev_warn(&vcdev->cdev->dev, "no info block\n");
 		err = -ENOMEM;
 		goto out_err;
 	}
@@ -1225,7 +1223,6 @@ static int virtio_ccw_online(struct ccw_device *cdev)
 
 	vcdev = kzalloc(sizeof(*vcdev), GFP_KERNEL);
 	if (!vcdev) {
-		dev_warn(&cdev->dev, "Could not get memory for virtio\n");
 		ret = -ENOMEM;
 		goto out_free;
 	}
-- 
2.13.0

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

* [PATCH 2/3] s390: virtio: Improve a size determination in virtio_ccw_setup_vq()
  2017-05-16 15:50 ` SF Markus Elfring
@ 2017-05-16 15:52   ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:52 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:05:01 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/s390/virtio/virtio_ccw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 447fe718c0ab..bfb845d7faa7 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -495,5 +495,5 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	unsigned long flags;
 
 	/* Allocate queue. */
-	info = kzalloc(sizeof(struct virtio_ccw_vq_info), GFP_KERNEL);
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
 	if (!info) {
-- 
2.13.0

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

* [PATCH 2/3] s390: virtio: Improve a size determination in virtio_ccw_setup_vq()
@ 2017-05-16 15:52   ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:52 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:05:01 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/s390/virtio/virtio_ccw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 447fe718c0ab..bfb845d7faa7 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -495,5 +495,5 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	unsigned long flags;
 
 	/* Allocate queue. */
-	info = kzalloc(sizeof(struct virtio_ccw_vq_info), GFP_KERNEL);
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
 	if (!info) {
-- 
2.13.0


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

* [PATCH 2/3] s390: virtio: Improve a size determination in virtio_ccw_setup_vq()
  2017-05-16 15:50 ` SF Markus Elfring
                   ` (3 preceding siblings ...)
  (?)
@ 2017-05-16 15:52 ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:52 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:05:01 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/s390/virtio/virtio_ccw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 447fe718c0ab..bfb845d7faa7 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -495,5 +495,5 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	unsigned long flags;
 
 	/* Allocate queue. */
-	info = kzalloc(sizeof(struct virtio_ccw_vq_info), GFP_KERNEL);
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
 	if (!info) {
-- 
2.13.0

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

* [PATCH 3/3] s390: virtio: Adjust a null pointer check in two functions
  2017-05-16 15:50 ` SF Markus Elfring
@ 2017-05-16 15:53   ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:53 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:14:26 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed 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/s390/virtio/virtio_ccw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index bfb845d7faa7..27ab0f0b59cd 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -513,7 +513,7 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	}
 	size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
 	info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
-	if (info->queue == NULL) {
+	if (!info->queue) {
 		dev_warn(&vcdev->cdev->dev, "no queue\n");
 		err = -ENOMEM;
 		goto out_err;
@@ -1388,7 +1388,7 @@ static void __init no_auto_parse(void)
 				 &from_ssid, &from);
 		if (rc)
 			continue;
-		if (parm != NULL) {
+		if (parm) {
 			rc = parse_busid(parm, &to_cssid,
 					 &to_ssid, &to);
 			if ((from_ssid > to_ssid) ||
-- 
2.13.0

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

* [PATCH 3/3] s390: virtio: Adjust a null pointer check in two functions
@ 2017-05-16 15:53   ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:53 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:14:26 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed 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/s390/virtio/virtio_ccw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index bfb845d7faa7..27ab0f0b59cd 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -513,7 +513,7 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	}
 	size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
 	info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
-	if (info->queue = NULL) {
+	if (!info->queue) {
 		dev_warn(&vcdev->cdev->dev, "no queue\n");
 		err = -ENOMEM;
 		goto out_err;
@@ -1388,7 +1388,7 @@ static void __init no_auto_parse(void)
 				 &from_ssid, &from);
 		if (rc)
 			continue;
-		if (parm != NULL) {
+		if (parm) {
 			rc = parse_busid(parm, &to_cssid,
 					 &to_ssid, &to);
 			if ((from_ssid > to_ssid) ||
-- 
2.13.0


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

* [PATCH 3/3] s390: virtio: Adjust a null pointer check in two functions
  2017-05-16 15:50 ` SF Markus Elfring
                   ` (4 preceding siblings ...)
  (?)
@ 2017-05-16 15:53 ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:53 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:14:26 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed 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/s390/virtio/virtio_ccw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index bfb845d7faa7..27ab0f0b59cd 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -513,7 +513,7 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 	}
 	size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
 	info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
-	if (info->queue == NULL) {
+	if (!info->queue) {
 		dev_warn(&vcdev->cdev->dev, "no queue\n");
 		err = -ENOMEM;
 		goto out_err;
@@ -1388,7 +1388,7 @@ static void __init no_auto_parse(void)
 				 &from_ssid, &from);
 		if (rc)
 			continue;
-		if (parm != NULL) {
+		if (parm) {
 			rc = parse_busid(parm, &to_cssid,
 					 &to_ssid, &to);
 			if ((from_ssid > to_ssid) ||
-- 
2.13.0

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* [PATCH 0/3] S390-virtio: Adjustments for three function implementations
@ 2017-05-16 15:50 SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-05-16 15:50 UTC (permalink / raw)
  To: kvm, linux-s390, virtualization, Cornelia Huck, Halil Pasic,
	Heiko Carstens, Martin Schwidefsky
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 17:43:21 +0200

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

Markus Elfring (3):
  Delete error messages for failed memory allocations in two functions
  Improve a size determination in virtio_ccw_setup_vq()
  Adjust a null pointer check in two functions

 drivers/s390/virtio/virtio_ccw.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

-- 
2.13.0

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

end of thread, other threads:[~2017-05-16 15:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 15:50 [PATCH 0/3] S390-virtio: Adjustments for three function implementations SF Markus Elfring
2017-05-16 15:50 ` SF Markus Elfring
2017-05-16 15:51 ` [PATCH 1/3] s390: virtio: Delete error messages for failed memory allocations in two functions SF Markus Elfring
2017-05-16 15:51 ` SF Markus Elfring
2017-05-16 15:51   ` SF Markus Elfring
2017-05-16 15:52 ` [PATCH 2/3] s390: virtio: Improve a size determination in virtio_ccw_setup_vq() SF Markus Elfring
2017-05-16 15:52   ` SF Markus Elfring
2017-05-16 15:52 ` SF Markus Elfring
2017-05-16 15:53 ` [PATCH 3/3] s390: virtio: Adjust a null pointer check in two functions SF Markus Elfring
2017-05-16 15:53 ` SF Markus Elfring
2017-05-16 15:53   ` SF Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2017-05-16 15:50 [PATCH 0/3] S390-virtio: Adjustments for three function implementations SF Markus Elfring

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.