linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] VME: Adjustments for several function implementations
@ 2017-08-25 15:41 SF Markus Elfring
  2017-08-25 15:51 ` [PATCH 01/14] vme: Delete 11 error messages for a failed memory allocation SF Markus Elfring
                   ` (14 more replies)
  0 siblings, 15 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 15:41 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, linux-kernel@vger.kernel.org >> LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 13:15:43 +0200

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

Markus Elfring (14):
  Delete 11 error messages for a failed memory allocation
  Improve 11 size determinations
  Move an assignment in vme_new_dma_list()
  Adjust 48 checks for null pointers
  Return directly in two functions
  fake: Delete an error message for a failed memory allocation in fake_init()
  fake: Improve five size determinations in fake_init()
  fake: Adjust 11 checks for null pointers
  ca91cx42: Delete eight error messages for a failed memory allocation
  ca91cx42: Improve 12 size determinations
  ca91cx42: Adjust 14 checks for null pointers
  tsi148: Delete nine error messages for a failed memory allocation
  tsi148: Improve 17 size determinations
  tsi148: Adjust 14 checks for null pointers

 drivers/vme/bridges/vme_ca91cx42.c |  73 +++++---------
 drivers/vme/bridges/vme_fake.c     |  35 +++----
 drivers/vme/bridges/vme_tsi148.c   |  82 ++++++----------
 drivers/vme/vme.c                  | 194 ++++++++++++++++---------------------
 4 files changed, 156 insertions(+), 228 deletions(-)

-- 
2.14.0

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

* [PATCH 01/14] vme: Delete 11 error messages for a failed memory allocation
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
@ 2017-08-25 15:51 ` SF Markus Elfring
  2017-08-25 15:53 ` [PATCH 02/14] vme: Improve 11 size determinations SF Markus Elfring
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 15:51 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 24 Aug 2017 21:38:20 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/vme/vme.c | 51 ++++++++++++++++-----------------------------------
 1 file changed, 16 insertions(+), 35 deletions(-)

diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 6a3ead42aba8..53e87af8e0b8 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -340,7 +340,6 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
-	if (resource == NULL) {
-		printk(KERN_WARNING "Unable to allocate resource structure\n");
+	if (!resource)
 		goto err_alloc;
-	}
+
 	resource->type = VME_SLAVE;
 	resource->entry = &allocated_image->list;
 
@@ -545,7 +544,6 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
-	if (resource == NULL) {
-		printk(KERN_ERR "Unable to allocate resource structure\n");
+	if (!resource)
 		goto err_alloc;
-	}
+
 	resource->type = VME_MASTER;
 	resource->entry = &allocated_image->list;
 
@@ -922,7 +920,6 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
-	if (resource == NULL) {
-		printk(KERN_WARNING "Unable to allocate resource structure\n");
+	if (!resource)
 		goto err_alloc;
-	}
+
 	resource->type = VME_DMA;
 	resource->entry = &allocated_ctrlr->list;
 
@@ -965,7 +962,6 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
-	if (dma_list == NULL) {
-		printk(KERN_ERR "Unable to allocate memory for new DMA list\n");
+	if (!dma_list)
 		return NULL;
-	}
+
 	INIT_LIST_HEAD(&dma_list->entries);
 	dma_list->parent = ctrlr;
 	mutex_init(&dma_list->mtx);
@@ -994,13 +990,9 @@ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type)
-	if (attributes == NULL) {
-		printk(KERN_ERR "Unable to allocate memory for attributes structure\n");
+	if (!attributes)
 		goto err_attr;
-	}
 
 	pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL);
-	if (pattern_attr == NULL) {
-		printk(KERN_ERR "Unable to allocate memory for pattern attributes\n");
+	if (!pattern_attr)
 		goto err_pat;
-	}
 
 	attributes->type = VME_DMA_PATTERN;
 	attributes->private = (void *)pattern_attr;
@@ -1038,15 +1030,9 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address)
-	if (attributes == NULL) {
-		printk(KERN_ERR "Unable to allocate memory for attributes structure\n");
+	if (!attributes)
 		goto err_attr;
-	}
 
 	pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL);
-	if (pci_attr == NULL) {
-		printk(KERN_ERR "Unable to allocate memory for PCI attributes\n");
+	if (!pci_attr)
 		goto err_pci;
-	}
-
-
 
 	attributes->type = VME_DMA_PCI;
 	attributes->private = (void *)pci_attr;
@@ -1086,13 +1072,9 @@ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address,
-	if (attributes == NULL) {
-		printk(KERN_ERR "Unable to allocate memory for attributes structure\n");
+	if (!attributes)
 		goto err_attr;
-	}
 
 	vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL);
-	if (vme_attr == NULL) {
-		printk(KERN_ERR "Unable to allocate memory for VME attributes\n");
+	if (!vme_attr)
 		goto err_vme;
-	}
 
 	attributes->type = VME_DMA_VME;
 	attributes->private = (void *)vme_attr;
@@ -1542,7 +1524,6 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
-	if (resource == NULL) {
-		printk(KERN_ERR "Unable to allocate resource structure\n");
+	if (!resource)
 		goto err_alloc;
-	}
+
 	resource->type = VME_LM;
 	resource->entry = &allocated_lm->list;
 
-- 
2.14.0

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

* [PATCH 02/14] vme: Improve 11 size determinations
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
  2017-08-25 15:51 ` [PATCH 01/14] vme: Delete 11 error messages for a failed memory allocation SF Markus Elfring
@ 2017-08-25 15:53 ` SF Markus Elfring
  2017-08-25 15:57 ` [PATCH 03/14] vme: Move an assignment in vme_new_dma_list() SF Markus Elfring
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 15:53 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 24 Aug 2017 21:52:00 +0200

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/vme/vme.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 53e87af8e0b8..1afddf5eafd4 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -337,4 +337,4 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
 		goto err_image;
 
-	resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+	resource = kmalloc(sizeof(*resource), GFP_KERNEL);
 	if (!resource)
@@ -540,5 +540,5 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
 		goto err_image;
 	}
 
-	resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+	resource = kmalloc(sizeof(*resource), GFP_KERNEL);
 	if (!resource)
@@ -917,4 +917,4 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
 		goto err_ctrlr;
 
-	resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+	resource = kmalloc(sizeof(*resource), GFP_KERNEL);
 	if (!resource)
@@ -958,5 +958,5 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
 
 	ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);
 
-	dma_list = kmalloc(sizeof(struct vme_dma_list), GFP_KERNEL);
+	dma_list = kmalloc(sizeof(*dma_list), GFP_KERNEL);
 	if (!dma_list)
@@ -986,9 +986,9 @@ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type)
 	struct vme_dma_attr *attributes;
 	struct vme_dma_pattern *pattern_attr;
 
-	attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
+	attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
 	if (!attributes)
 		goto err_attr;
 
-	pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL);
+	pattern_attr = kmalloc(sizeof(*pattern_attr), GFP_KERNEL);
 	if (!pattern_attr)
@@ -1026,9 +1026,9 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address)
 
 	/* XXX Run some sanity checks here */
 
-	attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
+	attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
 	if (!attributes)
 		goto err_attr;
 
-	pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL);
+	pci_attr = kmalloc(sizeof(*pci_attr), GFP_KERNEL);
 	if (!pci_attr)
@@ -1067,10 +1067,9 @@ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address,
 	struct vme_dma_attr *attributes;
 	struct vme_dma_vme *vme_attr;
 
-	attributes = kmalloc(
-		sizeof(struct vme_dma_attr), GFP_KERNEL);
+	attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
 	if (!attributes)
 		goto err_attr;
 
-	vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL);
+	vme_attr = kmalloc(sizeof(*vme_attr), GFP_KERNEL);
 	if (!vme_attr)
@@ -1521,4 +1520,4 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
 		goto err_lm;
 
-	resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+	resource = kmalloc(sizeof(*resource), GFP_KERNEL);
 	if (!resource)
@@ -1869,5 +1868,5 @@ static int __vme_register_driver_bus(struct vme_driver *drv,
 	struct vme_dev *tmp;
 
 	for (i = 0; i < ndevs; i++) {
-		vdev = kzalloc(sizeof(struct vme_dev), GFP_KERNEL);
+		vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
 		if (!vdev) {
-- 
2.14.0

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

* [PATCH 03/14] vme: Move an assignment in vme_new_dma_list()
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
  2017-08-25 15:51 ` [PATCH 01/14] vme: Delete 11 error messages for a failed memory allocation SF Markus Elfring
  2017-08-25 15:53 ` [PATCH 02/14] vme: Improve 11 size determinations SF Markus Elfring
@ 2017-08-25 15:57 ` SF Markus Elfring
  2017-08-25 15:59 ` [PATCH 04/14] vme: Adjust 48 checks for null pointers SF Markus Elfring
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 15:57 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 24 Aug 2017 22:04:45 +0200

Assign a pointer to a data structure member without using an intermediate
local variable.

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

diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 1afddf5eafd4..d890410e472d 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -948,7 +948,6 @@ EXPORT_SYMBOL(vme_dma_request);
  */
 struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
 {
-	struct vme_dma_resource *ctrlr;
 	struct vme_dma_list *dma_list;
 
 	if (resource->type != VME_DMA) {
@@ -956,14 +955,14 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
 		return NULL;
 	}
 
-	ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);
-
 	dma_list = kmalloc(sizeof(*dma_list), GFP_KERNEL);
 	if (!dma_list)
 		return NULL;
 
 	INIT_LIST_HEAD(&dma_list->entries);
-	dma_list->parent = ctrlr;
+	dma_list->parent = list_entry(resource->entry,
+				      struct vme_dma_resource,
+				      list);
 	mutex_init(&dma_list->mtx);
 
 	return dma_list;
-- 
2.14.0

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

* [PATCH 04/14] vme: Adjust 48 checks for null pointers
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-08-25 15:57 ` [PATCH 03/14] vme: Move an assignment in vme_new_dma_list() SF Markus Elfring
@ 2017-08-25 15:59 ` SF Markus Elfring
  2017-08-25 16:00 ` [PATCH 05/14] vme: Return directly in two functions SF Markus Elfring
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 15:59 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 24 Aug 2017 22:24:38 +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/vme/vme.c | 101 ++++++++++++++++++++++++++----------------------------
 1 file changed, 48 insertions(+), 53 deletions(-)

diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index d890410e472d..a2e36e6a0d84 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -92,23 +92,23 @@ void *vme_alloc_consistent(struct vme_resource *resource, size_t size,
 {
 	struct vme_bridge *bridge;
 
-	if (resource == NULL) {
+	if (!resource) {
 		printk(KERN_ERR "No resource\n");
 		return NULL;
 	}
 
 	bridge = find_bridge(resource);
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find bridge\n");
 		return NULL;
 	}
 
-	if (bridge->parent == NULL) {
+	if (!bridge->parent) {
 		printk(KERN_ERR "Dev entry NULL for bridge %s\n", bridge->name);
 		return NULL;
 	}
 
-	if (bridge->alloc_consistent == NULL) {
+	if (!bridge->alloc_consistent) {
 		printk(KERN_ERR "alloc_consistent not supported by bridge %s\n",
 		       bridge->name);
 		return NULL;
@@ -132,23 +132,23 @@ void vme_free_consistent(struct vme_resource *resource, size_t size,
 {
 	struct vme_bridge *bridge;
 
-	if (resource == NULL) {
+	if (!resource) {
 		printk(KERN_ERR "No resource\n");
 		return;
 	}
 
 	bridge = find_bridge(resource);
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find bridge\n");
 		return;
 	}
 
-	if (bridge->parent == NULL) {
+	if (!bridge->parent) {
 		printk(KERN_ERR "Dev entry NULL for bridge %s\n", bridge->name);
 		return;
 	}
 
-	if (bridge->free_consistent == NULL) {
+	if (!bridge->free_consistent) {
 		printk(KERN_ERR "free_consistent not supported by bridge %s\n",
 		       bridge->name);
 		return;
@@ -303,7 +303,7 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
 	struct vme_resource *resource = NULL;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		goto err_bus;
 	}
@@ -313,7 +313,7 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
 		slave_image = list_entry(slave_pos,
 			struct vme_slave_resource, list);
 
-		if (slave_image == NULL) {
+		if (!slave_image) {
 			printk(KERN_ERR "Registered NULL Slave resource\n");
 			continue;
 		}
@@ -333,7 +333,7 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
 	}
 
 	/* No free image */
-	if (allocated_image == NULL)
+	if (!allocated_image)
 		goto err_image;
 
 	resource = kmalloc(sizeof(*resource), GFP_KERNEL);
@@ -388,7 +388,7 @@ int vme_slave_set(struct vme_resource *resource, int enabled,
 
 	image = list_entry(resource->entry, struct vme_slave_resource, list);
 
-	if (bridge->slave_set == NULL) {
+	if (!bridge->slave_set) {
 		printk(KERN_ERR "Function not supported\n");
 		return -ENOSYS;
 	}
@@ -437,7 +437,7 @@ int vme_slave_get(struct vme_resource *resource, int *enabled,
 
 	image = list_entry(resource->entry, struct vme_slave_resource, list);
 
-	if (bridge->slave_get == NULL) {
+	if (!bridge->slave_get) {
 		printk(KERN_ERR "vme_slave_get not supported\n");
 		return -EINVAL;
 	}
@@ -464,7 +464,7 @@ void vme_slave_free(struct vme_resource *resource)
 
 	slave_image = list_entry(resource->entry, struct vme_slave_resource,
 		list);
-	if (slave_image == NULL) {
+	if (!slave_image) {
 		printk(KERN_ERR "Can't find slave resource\n");
 		return;
 	}
@@ -504,7 +504,7 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
 	struct vme_resource *resource = NULL;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		goto err_bus;
 	}
@@ -514,7 +514,7 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
 		master_image = list_entry(master_pos,
 			struct vme_master_resource, list);
 
-		if (master_image == NULL) {
+		if (!master_image) {
 			printk(KERN_WARNING "Registered NULL master resource\n");
 			continue;
 		}
@@ -535,7 +535,7 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
 	}
 
 	/* Check to see if we found a resource */
-	if (allocated_image == NULL) {
+	if (!allocated_image) {
 		printk(KERN_ERR "Can't find a suitable resource\n");
 		goto err_image;
 	}
@@ -592,7 +592,7 @@ int vme_master_set(struct vme_resource *resource, int enabled,
 
 	image = list_entry(resource->entry, struct vme_master_resource, list);
 
-	if (bridge->master_set == NULL) {
+	if (!bridge->master_set) {
 		printk(KERN_WARNING "vme_master_set not supported\n");
 		return -EINVAL;
 	}
@@ -642,7 +642,7 @@ int vme_master_get(struct vme_resource *resource, int *enabled,
 
 	image = list_entry(resource->entry, struct vme_master_resource, list);
 
-	if (bridge->master_get == NULL) {
+	if (!bridge->master_get) {
 		printk(KERN_WARNING "%s not supported\n", __func__);
 		return -EINVAL;
 	}
@@ -674,7 +674,7 @@ ssize_t vme_master_read(struct vme_resource *resource, void *buf, size_t count,
 	struct vme_master_resource *image;
 	size_t length;
 
-	if (bridge->master_read == NULL) {
+	if (!bridge->master_read) {
 		printk(KERN_WARNING "Reading from resource not supported\n");
 		return -EINVAL;
 	}
@@ -723,7 +723,7 @@ ssize_t vme_master_write(struct vme_resource *resource, void *buf,
 	struct vme_master_resource *image;
 	size_t length;
 
-	if (bridge->master_write == NULL) {
+	if (!bridge->master_write) {
 		printk(KERN_WARNING "Writing to resource not supported\n");
 		return -EINVAL;
 	}
@@ -774,7 +774,7 @@ unsigned int vme_master_rmw(struct vme_resource *resource, unsigned int mask,
 	struct vme_bridge *bridge = find_bridge(resource);
 	struct vme_master_resource *image;
 
-	if (bridge->master_rmw == NULL) {
+	if (!bridge->master_rmw) {
 		printk(KERN_WARNING "Writing to resource not supported\n");
 		return -EINVAL;
 	}
@@ -844,7 +844,7 @@ void vme_master_free(struct vme_resource *resource)
 
 	master_image = list_entry(resource->entry, struct vme_master_resource,
 		list);
-	if (master_image == NULL) {
+	if (!master_image) {
 		printk(KERN_ERR "Can't find master resource\n");
 		return;
 	}
@@ -884,7 +884,7 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
 	printk(KERN_ERR "No VME resource Attribute tests done\n");
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		goto err_bus;
 	}
@@ -893,8 +893,7 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
 	list_for_each(dma_pos, &bridge->dma_resources) {
 		dma_ctrlr = list_entry(dma_pos,
 			struct vme_dma_resource, list);
-
-		if (dma_ctrlr == NULL) {
+		if (!dma_ctrlr) {
 			printk(KERN_ERR "Registered NULL DMA resource\n");
 			continue;
 		}
@@ -913,7 +912,7 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
 	}
 
 	/* Check to see if we found a resource */
-	if (allocated_ctrlr == NULL)
+	if (!allocated_ctrlr)
 		goto err_ctrlr;
 
 	resource = kmalloc(sizeof(*resource), GFP_KERNEL);
@@ -1128,7 +1127,7 @@ int vme_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
 	struct vme_bridge *bridge = list->parent->parent;
 	int retval;
 
-	if (bridge->dma_list_add == NULL) {
+	if (!bridge->dma_list_add) {
 		printk(KERN_WARNING "Link List DMA generation not supported\n");
 		return -EINVAL;
 	}
@@ -1161,7 +1160,7 @@ int vme_dma_list_exec(struct vme_dma_list *list)
 	struct vme_bridge *bridge = list->parent->parent;
 	int retval;
 
-	if (bridge->dma_list_exec == NULL) {
+	if (!bridge->dma_list_exec) {
 		printk(KERN_ERR "Link List DMA execution not supported\n");
 		return -EINVAL;
 	}
@@ -1190,7 +1189,7 @@ int vme_dma_list_free(struct vme_dma_list *list)
 	struct vme_bridge *bridge = list->parent->parent;
 	int retval;
 
-	if (bridge->dma_list_empty == NULL) {
+	if (!bridge->dma_list_empty) {
 		printk(KERN_WARNING "Emptying of Link Lists not supported\n");
 		return -EINVAL;
 	}
@@ -1322,8 +1321,7 @@ void vme_irq_handler(struct vme_bridge *bridge, int level, int statid)
 
 	call = bridge->irq[level - 1].callback[statid].func;
 	priv_data = bridge->irq[level - 1].callback[statid].priv_data;
-
-	if (call != NULL)
+	if (call)
 		call(level, statid, priv_data);
 	else
 		printk(KERN_WARNING "Spurious VME interrupt, level:%x, vector:%x\n",
@@ -1354,7 +1352,7 @@ int vme_irq_request(struct vme_dev *vdev, int level, int statid,
 	struct vme_bridge *bridge;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		return -EINVAL;
 	}
@@ -1364,7 +1362,7 @@ int vme_irq_request(struct vme_dev *vdev, int level, int statid,
 		return -EINVAL;
 	}
 
-	if (bridge->irq_set == NULL) {
+	if (!bridge->irq_set) {
 		printk(KERN_ERR "Configuring interrupts not supported\n");
 		return -EINVAL;
 	}
@@ -1403,7 +1401,7 @@ void vme_irq_free(struct vme_dev *vdev, int level, int statid)
 	struct vme_bridge *bridge;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		return;
 	}
@@ -1413,7 +1411,7 @@ void vme_irq_free(struct vme_dev *vdev, int level, int statid)
 		return;
 	}
 
-	if (bridge->irq_set == NULL) {
+	if (!bridge->irq_set) {
 		printk(KERN_ERR "Configuring interrupts not supported\n");
 		return;
 	}
@@ -1450,7 +1448,7 @@ int vme_irq_generate(struct vme_dev *vdev, int level, int statid)
 	struct vme_bridge *bridge;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		return -EINVAL;
 	}
@@ -1460,7 +1458,7 @@ int vme_irq_generate(struct vme_dev *vdev, int level, int statid)
 		return -EINVAL;
 	}
 
-	if (bridge->irq_generate == NULL) {
+	if (!bridge->irq_generate) {
 		printk(KERN_WARNING "Interrupt generation not supported\n");
 		return -EINVAL;
 	}
@@ -1488,7 +1486,7 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
 	struct vme_resource *resource = NULL;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		goto err_bus;
 	}
@@ -1497,8 +1495,7 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
 	list_for_each(lm_pos, &bridge->lm_resources) {
 		lm = list_entry(lm_pos,
 			struct vme_lm_resource, list);
-
-		if (lm == NULL) {
+		if (!lm) {
 			printk(KERN_ERR "Registered NULL Location Monitor resource\n");
 			continue;
 		}
@@ -1515,7 +1512,7 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
 	}
 
 	/* Check to see if we found a resource */
-	if (allocated_lm == NULL)
+	if (!allocated_lm)
 		goto err_lm;
 
 	resource = kmalloc(sizeof(*resource), GFP_KERNEL);
@@ -1591,7 +1588,7 @@ int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base,
 
 	lm = list_entry(resource->entry, struct vme_lm_resource, list);
 
-	if (bridge->lm_set == NULL) {
+	if (!bridge->lm_set) {
 		printk(KERN_ERR "vme_lm_set not supported\n");
 		return -EINVAL;
 	}
@@ -1627,7 +1624,7 @@ int vme_lm_get(struct vme_resource *resource, unsigned long long *lm_base,
 
 	lm = list_entry(resource->entry, struct vme_lm_resource, list);
 
-	if (bridge->lm_get == NULL) {
+	if (!bridge->lm_get) {
 		printk(KERN_ERR "vme_lm_get not supported\n");
 		return -EINVAL;
 	}
@@ -1664,7 +1661,7 @@ int vme_lm_attach(struct vme_resource *resource, int monitor,
 
 	lm = list_entry(resource->entry, struct vme_lm_resource, list);
 
-	if (bridge->lm_attach == NULL) {
+	if (!bridge->lm_attach) {
 		printk(KERN_ERR "vme_lm_attach not supported\n");
 		return -EINVAL;
 	}
@@ -1697,7 +1694,7 @@ int vme_lm_detach(struct vme_resource *resource, int monitor)
 
 	lm = list_entry(resource->entry, struct vme_lm_resource, list);
 
-	if (bridge->lm_detach == NULL) {
+	if (!bridge->lm_detach) {
 		printk(KERN_ERR "vme_lm_detach not supported\n");
 		return -EINVAL;
 	}
@@ -1759,12 +1756,12 @@ int vme_slot_num(struct vme_dev *vdev)
 	struct vme_bridge *bridge;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		printk(KERN_ERR "Can't find VME bus\n");
 		return -EINVAL;
 	}
 
-	if (bridge->slot_get == NULL) {
+	if (!bridge->slot_get) {
 		printk(KERN_WARNING "vme_slot_num not supported\n");
 		return -EINVAL;
 	}
@@ -1787,7 +1784,7 @@ int vme_bus_num(struct vme_dev *vdev)
 	struct vme_bridge *bridge;
 
 	bridge = vdev->bridge;
-	if (bridge == NULL) {
+	if (!bridge) {
 		pr_err("Can't find VME bus\n");
 		return -EINVAL;
 	}
@@ -2004,8 +2001,7 @@ static int vme_bus_probe(struct device *dev)
 	struct vme_dev *vdev = dev_to_vme_dev(dev);
 
 	driver = dev->platform_data;
-
-	if (driver->probe != NULL)
+	if (driver->probe)
 		retval = driver->probe(vdev);
 
 	return retval;
@@ -2018,8 +2014,7 @@ static int vme_bus_remove(struct device *dev)
 	struct vme_dev *vdev = dev_to_vme_dev(dev);
 
 	driver = dev->platform_data;
-
-	if (driver->remove != NULL)
+	if (driver->remove)
 		retval = driver->remove(vdev);
 
 	return retval;
-- 
2.14.0

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

* [PATCH 05/14] vme: Return directly in two functions
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  2017-08-25 15:59 ` [PATCH 04/14] vme: Adjust 48 checks for null pointers SF Markus Elfring
@ 2017-08-25 16:00 ` SF Markus Elfring
  2017-08-25 16:02 ` [PATCH 06/14] vme: fake: Delete an error message for a failed memory allocation in fake_init() SF Markus Elfring
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:00 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 24 Aug 2017 22:32:14 +0200

Return directly without using an intermediate local variable
in these functions.

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

diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index a2e36e6a0d84..986799d64993 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -1996,28 +1996,26 @@ static int vme_bus_match(struct device *dev, struct device_driver *drv)
 
 static int vme_bus_probe(struct device *dev)
 {
-	int retval = -ENODEV;
 	struct vme_driver *driver;
 	struct vme_dev *vdev = dev_to_vme_dev(dev);
 
 	driver = dev->platform_data;
 	if (driver->probe)
-		retval = driver->probe(vdev);
+		return driver->probe(vdev);
 
-	return retval;
+	return -ENODEV;
 }
 
 static int vme_bus_remove(struct device *dev)
 {
-	int retval = -ENODEV;
 	struct vme_driver *driver;
 	struct vme_dev *vdev = dev_to_vme_dev(dev);
 
 	driver = dev->platform_data;
 	if (driver->remove)
-		retval = driver->remove(vdev);
+		return driver->remove(vdev);
 
-	return retval;
+	return -ENODEV;
 }
 
 struct bus_type vme_bus_type = {
-- 
2.14.0

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

* [PATCH 06/14] vme: fake: Delete an error message for a failed memory allocation in fake_init()
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (4 preceding siblings ...)
  2017-08-25 16:00 ` [PATCH 05/14] vme: Return directly in two functions SF Markus Elfring
@ 2017-08-25 16:02 ` SF Markus Elfring
  2017-08-25 16:03 ` [PATCH 07/14] vme: fake: Improve five size determinations " SF Markus Elfring
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:02 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 09:31:46 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/vme/bridges/vme_fake.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c
index 30b3acc93833..6ceea5e9fd8b 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/vme/bridges/vme_fake.c
@@ -1159,4 +1159,3 @@ static int __init fake_init(void)
-		pr_err("Failed to allocate memory for location monitor resource structure\n");
 		retval = -ENOMEM;
 		goto err_lm;
 	}
-- 
2.14.0

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

* [PATCH 07/14] vme: fake: Improve five size determinations in fake_init()
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (5 preceding siblings ...)
  2017-08-25 16:02 ` [PATCH 06/14] vme: fake: Delete an error message for a failed memory allocation in fake_init() SF Markus Elfring
@ 2017-08-25 16:03 ` SF Markus Elfring
  2017-08-25 16:05 ` [PATCH 08/14] vme: fake: Adjust 11 checks for null pointers SF Markus Elfring
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:03 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 09:46:13 +0200

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/vme/bridges/vme_fake.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c
index 6ceea5e9fd8b..39f84df44557 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/vme/bridges/vme_fake.c
@@ -1075,11 +1075,11 @@ static int __init fake_init(void)
 	/* If we want to support more than one bridge at some point, we need to
 	 * dynamically allocate this so we get one per device.
 	 */
-	fake_bridge = kzalloc(sizeof(struct vme_bridge), GFP_KERNEL);
+	fake_bridge = kzalloc(sizeof(*fake_bridge), GFP_KERNEL);
 	if (fake_bridge == NULL) {
 		retval = -ENOMEM;
 		goto err_struct;
 	}
 
-	fake_device = kzalloc(sizeof(struct fake_driver), GFP_KERNEL);
+	fake_device = kzalloc(sizeof(*fake_device), GFP_KERNEL);
 	if (fake_device == NULL) {
@@ -1104,6 +1104,5 @@ static int __init fake_init(void)
 	/* Add master windows to list */
 	INIT_LIST_HEAD(&fake_bridge->master_resources);
 	for (i = 0; i < FAKE_MAX_MASTER; i++) {
-		master_image = kmalloc(sizeof(struct vme_master_resource),
-				GFP_KERNEL);
+		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
 		if (master_image == NULL) {
@@ -1131,6 +1130,5 @@ static int __init fake_init(void)
 	/* Add slave windows to list */
 	INIT_LIST_HEAD(&fake_bridge->slave_resources);
 	for (i = 0; i < FAKE_MAX_SLAVE; i++) {
-		slave_image = kmalloc(sizeof(struct vme_slave_resource),
-				GFP_KERNEL);
+		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
 		if (slave_image == NULL) {
@@ -1154,5 +1152,5 @@ static int __init fake_init(void)
 
 	/* Add location monitor to list */
 	INIT_LIST_HEAD(&fake_bridge->lm_resources);
-	lm = kmalloc(sizeof(struct vme_lm_resource), GFP_KERNEL);
+	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
 	if (lm == NULL) {
-- 
2.14.0

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

* [PATCH 08/14] vme: fake: Adjust 11 checks for null pointers
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (6 preceding siblings ...)
  2017-08-25 16:03 ` [PATCH 07/14] vme: fake: Improve five size determinations " SF Markus Elfring
@ 2017-08-25 16:05 ` SF Markus Elfring
  2017-08-25 16:06 ` [PATCH 09/14] vme: ca91cx42: Delete eight error messages for a failed memory allocation SF Markus Elfring
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:05 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 10:01:16 +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/vme/bridges/vme_fake.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c
index 39f84df44557..7d83691047f4 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/vme/bridges/vme_fake.c
@@ -409,7 +409,7 @@ static void fake_lm_check(struct fake_driver *bridge, unsigned long long addr,
 				/* Each location monitor covers 8 bytes */
 				if (((lm_base + (8 * i)) <= addr) &&
 				    ((lm_base + (8 * i) + 8) > addr)) {
-					if (bridge->lm_callback[i] != NULL)
+					if (bridge->lm_callback[i])
 						bridge->lm_callback[i](
 							bridge->lm_data[i]);
 				}
@@ -866,7 +866,7 @@ static int fake_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
 
 	/* If we already have a callback attached, we can't move it! */
 	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i] != NULL) {
+		if (bridge->lm_callback[i]) {
 			mutex_unlock(&lm->mtx);
 			pr_err("Location monitor callback attached, can't reset\n");
 			return -EBUSY;
@@ -940,7 +940,7 @@ static int fake_lm_attach(struct vme_lm_resource *lm, int monitor,
 	}
 
 	/* Check that a callback isn't already attached */
-	if (bridge->lm_callback[monitor] != NULL) {
+	if (bridge->lm_callback[monitor]) {
 		mutex_unlock(&lm->mtx);
 		pr_err("Existing callback attached\n");
 		return -EBUSY;
@@ -978,7 +978,7 @@ static int fake_lm_detach(struct vme_lm_resource *lm, int monitor)
 	/* If all location monitors disabled, disable global Location Monitor */
 	tmp = 0;
 	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i] != NULL)
+		if (bridge->lm_callback[i])
 			tmp = 1;
 	}
 
@@ -1003,7 +1003,7 @@ static void *fake_alloc_consistent(struct device *parent, size_t size,
 {
 	void *alloc = kmalloc(size, GFP_KERNEL);
 
-	if (alloc != NULL)
+	if (alloc)
 		*dma = fake_ptr_to_pci(alloc);
 
 	return alloc;
@@ -1039,7 +1039,7 @@ static int fake_crcsr_init(struct vme_bridge *fake_bridge)
 	/* Allocate mem for CR/CSR image */
 	bridge->crcsr_kernel = kzalloc(VME_CRCSR_BUF_SIZE, GFP_KERNEL);
 	bridge->crcsr_bus = fake_ptr_to_pci(bridge->crcsr_kernel);
-	if (bridge->crcsr_kernel == NULL)
+	if (!bridge->crcsr_kernel)
 		return -ENOMEM;
 
 	vstat = fake_slot_get(fake_bridge);
@@ -1076,13 +1076,13 @@ static int __init fake_init(void)
 	 * dynamically allocate this so we get one per device.
 	 */
 	fake_bridge = kzalloc(sizeof(*fake_bridge), GFP_KERNEL);
-	if (fake_bridge == NULL) {
+	if (!fake_bridge) {
 		retval = -ENOMEM;
 		goto err_struct;
 	}
 
 	fake_device = kzalloc(sizeof(*fake_device), GFP_KERNEL);
-	if (fake_device == NULL) {
+	if (!fake_device) {
 		retval = -ENOMEM;
 		goto err_driver;
 	}
@@ -1105,7 +1105,7 @@ static int __init fake_init(void)
 	INIT_LIST_HEAD(&fake_bridge->master_resources);
 	for (i = 0; i < FAKE_MAX_MASTER; i++) {
 		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
-		if (master_image == NULL) {
+		if (!master_image) {
 			retval = -ENOMEM;
 			goto err_master;
 		}
@@ -1131,7 +1131,7 @@ static int __init fake_init(void)
 	INIT_LIST_HEAD(&fake_bridge->slave_resources);
 	for (i = 0; i < FAKE_MAX_SLAVE; i++) {
 		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
-		if (slave_image == NULL) {
+		if (!slave_image) {
 			retval = -ENOMEM;
 			goto err_slave;
 		}
@@ -1153,7 +1153,7 @@ static int __init fake_init(void)
 	/* Add location monitor to list */
 	INIT_LIST_HEAD(&fake_bridge->lm_resources);
 	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
-	if (lm == NULL) {
+	if (!lm) {
 		retval = -ENOMEM;
 		goto err_lm;
 	}
-- 
2.14.0

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

* [PATCH 09/14] vme: ca91cx42: Delete eight error messages for a failed memory allocation
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (7 preceding siblings ...)
  2017-08-25 16:05 ` [PATCH 08/14] vme: fake: Adjust 11 checks for null pointers SF Markus Elfring
@ 2017-08-25 16:06 ` SF Markus Elfring
  2017-08-25 16:08 ` [PATCH 10/14] vme: ca91cx42: Improve 12 size determinations SF Markus Elfring
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:06 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 10:20:03 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/vme/bridges/vme_ca91cx42.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index 7cc51223db1c..d25f997e8aeb 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -538,5 +538,3 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
-			dev_err(ca91cx42_bridge->parent, "Unable to allocate "
-				"memory for resource name\n");
 			retval = -ENOMEM;
 			goto err_name;
 		}
@@ -1041,5 +1039,3 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
-		dev_err(dev, "Failed to allocate memory for dma resource "
-			"structure\n");
 		retval = -ENOMEM;
 		goto err_mem;
 	}
@@ -1624,5 +1620,3 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-		dev_err(&pdev->dev, "Failed to allocate memory for device "
-			"structure\n");
 		retval = -ENOMEM;
 		goto err_struct;
 	}
@@ -1634,5 +1628,3 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-		dev_err(&pdev->dev, "Failed to allocate memory for device "
-			"structure\n");
 		retval = -ENOMEM;
 		goto err_driver;
 	}
@@ -1694,5 +1686,3 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-			dev_err(&pdev->dev, "Failed to allocate memory for "
-			"master resource structure\n");
 			retval = -ENOMEM;
 			goto err_master;
 		}
@@ -1720,5 +1710,3 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-			dev_err(&pdev->dev, "Failed to allocate memory for "
-			"slave resource structure\n");
 			retval = -ENOMEM;
 			goto err_slave;
 		}
@@ -1747,5 +1735,3 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-			dev_err(&pdev->dev, "Failed to allocate memory for "
-			"dma resource structure\n");
 			retval = -ENOMEM;
 			goto err_dma;
 		}
@@ -1767,5 +1753,3 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-		dev_err(&pdev->dev, "Failed to allocate memory for "
-		"location monitor resource structure\n");
 		retval = -ENOMEM;
 		goto err_lm;
 	}
-- 
2.14.0

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

* [PATCH 10/14] vme: ca91cx42: Improve 12 size determinations
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (8 preceding siblings ...)
  2017-08-25 16:06 ` [PATCH 09/14] vme: ca91cx42: Delete eight error messages for a failed memory allocation SF Markus Elfring
@ 2017-08-25 16:08 ` SF Markus Elfring
  2017-08-25 16:10 ` [PATCH 11/14] vme: ca91cx42: Adjust 14 checks for null pointers SF Markus Elfring
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:08 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 10:56:41 +0200

Replace the specification of data structures by variable references
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/vme/bridges/vme_ca91cx42.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index d25f997e8aeb..61990c7f4543 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -529,7 +529,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 		image->kern_base = NULL;
 		kfree(image->bus_resource.name);
 		release_resource(&image->bus_resource);
-		memset(&image->bus_resource, 0, sizeof(struct resource));
+		memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 	}
 
 	if (image->bus_resource.name == NULL) {
@@ -572,7 +572,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 	release_resource(&image->bus_resource);
 err_resource:
 	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(struct resource));
+	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 err_name:
 	return retval;
 }
@@ -586,7 +586,7 @@ static void ca91cx42_free_resource(struct vme_master_resource *image)
 	image->kern_base = NULL;
 	release_resource(&image->bus_resource);
 	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(struct resource));
+	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 }
 
 
@@ -1034,5 +1034,5 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
 	dev = list->parent->parent->parent;
 
 	/* XXX descriptor must be aligned on 64-bit boundaries */
-	entry = kmalloc(sizeof(struct ca91cx42_dma_entry), GFP_KERNEL);
+	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
 	if (entry == NULL) {
@@ -1048,7 +1048,7 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
 		goto err_align;
 	}
 
-	memset(&entry->descriptor, 0, sizeof(struct ca91cx42_dma_descriptor));
+	memset(&entry->descriptor, 0, sizeof(entry->descriptor));
 
 	if (dest->type == VME_DMA_VME) {
 		entry->descriptor.dctl |= CA91CX42_DCTL_L2V;
@@ -1614,14 +1614,12 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* We want to support more than one of each bridge so we need to
 	 * dynamically allocate the bridge structure
 	 */
-	ca91cx42_bridge = kzalloc(sizeof(struct vme_bridge), GFP_KERNEL);
-
+	ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
 	if (ca91cx42_bridge == NULL) {
 		retval = -ENOMEM;
 		goto err_struct;
 	}
 	vme_init_bridge(ca91cx42_bridge);
 
-	ca91cx42_device = kzalloc(sizeof(struct ca91cx42_driver), GFP_KERNEL);
-
+	ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
 	if (ca91cx42_device == NULL) {
@@ -1680,6 +1678,5 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Add master windows to list */
 	for (i = 0; i < CA91C142_MAX_MASTER; i++) {
-		master_image = kmalloc(sizeof(struct vme_master_resource),
-			GFP_KERNEL);
+		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
 		if (master_image == NULL) {
@@ -1696,7 +1693,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
 		master_image->width_attr = VME_D8 | VME_D16 | VME_D32 | VME_D64;
 		memset(&master_image->bus_resource, 0,
-			sizeof(struct resource));
+		       sizeof(master_image->bus_resource));
 		master_image->kern_base  = NULL;
 		list_add_tail(&master_image->list,
 			&ca91cx42_bridge->master_resources);
@@ -1704,6 +1701,5 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Add slave windows to list */
 	for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
-		slave_image = kmalloc(sizeof(struct vme_slave_resource),
-			GFP_KERNEL);
+		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
 		if (slave_image == NULL) {
@@ -1729,6 +1725,5 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Add dma engines to list */
 	for (i = 0; i < CA91C142_MAX_DMA; i++) {
-		dma_ctrlr = kmalloc(sizeof(struct vme_dma_resource),
-			GFP_KERNEL);
+		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
 		if (dma_ctrlr == NULL) {
@@ -1748,5 +1743,5 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	}
 
 	/* Add location monitor to list */
-	lm = kmalloc(sizeof(struct vme_lm_resource), GFP_KERNEL);
+	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
 	if (lm == NULL) {
-- 
2.14.0

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

* [PATCH 11/14] vme: ca91cx42: Adjust 14 checks for null pointers
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (9 preceding siblings ...)
  2017-08-25 16:08 ` [PATCH 10/14] vme: ca91cx42: Improve 12 size determinations SF Markus Elfring
@ 2017-08-25 16:10 ` SF Markus Elfring
  2017-08-25 16:13 ` [PATCH 12/14] vme: tsi148: Delete nine error messages for a failed memory allocation SF Markus Elfring
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:10 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 11:01:29 +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/vme/bridges/vme_ca91cx42.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index 61990c7f4543..5dd284008630 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -511,7 +511,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 	ca91cx42_bridge = image->parent;
 
 	/* Find pci_dev container of dev */
-	if (ca91cx42_bridge->parent == NULL) {
+	if (!ca91cx42_bridge->parent) {
 		dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
 		return -EINVAL;
 	}
@@ -532,9 +532,9 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 		memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 	}
 
-	if (image->bus_resource.name == NULL) {
+	if (!image->bus_resource.name) {
 		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
-		if (image->bus_resource.name == NULL) {
+		if (!image->bus_resource.name) {
 			retval = -ENOMEM;
 			goto err_name;
 		}
@@ -560,7 +560,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 
 	image->kern_base = ioremap_nocache(
 		image->bus_resource.start, size);
-	if (image->kern_base == NULL) {
+	if (!image->kern_base) {
 		dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
 		retval = -ENOMEM;
 		goto err_remap;
@@ -1035,7 +1035,7 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
 
 	/* XXX descriptor must be aligned on 64-bit boundaries */
 	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
-	if (entry == NULL) {
+	if (!entry) {
 		retval = -ENOMEM;
 		goto err_mem;
 	}
@@ -1319,7 +1319,7 @@ static int ca91cx42_lm_set(struct vme_lm_resource *lm,
 
 	/* If we already have a callback attached, we can't move it! */
 	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i] != NULL) {
+		if (bridge->lm_callback[i]) {
 			mutex_unlock(&lm->mtx);
 			dev_err(dev, "Location monitor callback attached, "
 				"can't reset\n");
@@ -1428,7 +1428,7 @@ static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
 	}
 
 	/* Check that a callback isn't already attached */
-	if (bridge->lm_callback[monitor] != NULL) {
+	if (bridge->lm_callback[monitor]) {
 		mutex_unlock(&lm->mtx);
 		dev_err(dev, "Existing callback attached\n");
 		return -EBUSY;
@@ -1563,7 +1563,7 @@ static int ca91cx42_crcsr_init(struct vme_bridge *ca91cx42_bridge,
 	/* Allocate mem for CR/CSR image */
 	bridge->crcsr_kernel = pci_zalloc_consistent(pdev, VME_CRCSR_BUF_SIZE,
 						     &bridge->crcsr_bus);
-	if (bridge->crcsr_kernel == NULL) {
+	if (!bridge->crcsr_kernel) {
 		dev_err(&pdev->dev, "Failed to allocate memory for CR/CSR "
 			"image\n");
 		return -ENOMEM;
@@ -1615,14 +1615,14 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	 * dynamically allocate the bridge structure
 	 */
 	ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
-	if (ca91cx42_bridge == NULL) {
+	if (!ca91cx42_bridge) {
 		retval = -ENOMEM;
 		goto err_struct;
 	}
 	vme_init_bridge(ca91cx42_bridge);
 
 	ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
-	if (ca91cx42_device == NULL) {
+	if (!ca91cx42_device) {
 		retval = -ENOMEM;
 		goto err_driver;
 	}
@@ -1679,7 +1679,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* Add master windows to list */
 	for (i = 0; i < CA91C142_MAX_MASTER; i++) {
 		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
-		if (master_image == NULL) {
+		if (!master_image) {
 			retval = -ENOMEM;
 			goto err_master;
 		}
@@ -1702,7 +1702,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* Add slave windows to list */
 	for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
 		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
-		if (slave_image == NULL) {
+		if (!slave_image) {
 			retval = -ENOMEM;
 			goto err_slave;
 		}
@@ -1726,7 +1726,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* Add dma engines to list */
 	for (i = 0; i < CA91C142_MAX_DMA; i++) {
 		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
-		if (dma_ctrlr == NULL) {
+		if (!dma_ctrlr) {
 			retval = -ENOMEM;
 			goto err_dma;
 		}
@@ -1744,7 +1744,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Add location monitor to list */
 	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
-	if (lm == NULL) {
+	if (!lm) {
 		retval = -ENOMEM;
 		goto err_lm;
 	}
-- 
2.14.0

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

* [PATCH 12/14] vme: tsi148: Delete nine error messages for a failed memory allocation
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (10 preceding siblings ...)
  2017-08-25 16:10 ` [PATCH 11/14] vme: ca91cx42: Adjust 14 checks for null pointers SF Markus Elfring
@ 2017-08-25 16:13 ` SF Markus Elfring
  2017-08-25 16:15 ` [PATCH 13/14] vme: tsi148: Improve 17 size determinations SF Markus Elfring
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:13 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 11:10:07 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/vme/bridges/vme_tsi148.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index fc1b634b969a..fb91fddc6312 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -754,5 +754,3 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
-			dev_err(tsi148_bridge->parent, "Unable to allocate "
-				"memory for resource name\n");
 			retval = -ENOMEM;
 			goto err_name;
 		}
@@ -1646,5 +1644,3 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
-		dev_err(tsi148_bridge->parent, "Failed to allocate memory for "
-			"dma resource structure\n");
 		retval = -ENOMEM;
 		goto err_mem;
 	}
@@ -2299,5 +2295,3 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-		dev_err(&pdev->dev, "Failed to allocate memory for device "
-			"structure\n");
 		retval = -ENOMEM;
 		goto err_struct;
 	}
@@ -2308,5 +2302,3 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-		dev_err(&pdev->dev, "Failed to allocate memory for device "
-			"structure\n");
 		retval = -ENOMEM;
 		goto err_driver;
 	}
@@ -2376,5 +2368,3 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-			dev_err(&pdev->dev, "Failed to allocate memory for "
-			"flush resource structure\n");
 			retval = -ENOMEM;
 			goto err_master;
 		}
@@ -2395,5 +2385,3 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-			dev_err(&pdev->dev, "Failed to allocate memory for "
-			"master resource structure\n");
 			retval = -ENOMEM;
 			goto err_master;
 		}
@@ -2424,5 +2412,3 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-			dev_err(&pdev->dev, "Failed to allocate memory for "
-			"slave resource structure\n");
 			retval = -ENOMEM;
 			goto err_slave;
 		}
@@ -2448,5 +2434,3 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-			dev_err(&pdev->dev, "Failed to allocate memory for "
-			"dma resource structure\n");
 			retval = -ENOMEM;
 			goto err_dma;
 		}
@@ -2470,5 +2454,3 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-		dev_err(&pdev->dev, "Failed to allocate memory for "
-		"location monitor resource structure\n");
 		retval = -ENOMEM;
 		goto err_lm;
 	}
-- 
2.14.0

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

* [PATCH 13/14] vme: tsi148: Improve 17 size determinations
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (11 preceding siblings ...)
  2017-08-25 16:13 ` [PATCH 12/14] vme: tsi148: Delete nine error messages for a failed memory allocation SF Markus Elfring
@ 2017-08-25 16:15 ` SF Markus Elfring
  2017-08-25 20:57   ` Martyn Welch
  2017-08-25 16:17 ` [PATCH 14/14] vme: tsi148: Adjust 14 checks for null pointers SF Markus Elfring
  2017-08-25 21:50 ` [PATCH 00/14] VME: Adjustments for several function implementations Martyn Welch
  14 siblings, 1 reply; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:15 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 11:55:03 +0200

Replace the specification of data structures by variable references
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/vme/bridges/vme_tsi148.c | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index fb91fddc6312..61946f5d356f 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -741,7 +741,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 		image->kern_base = NULL;
 		kfree(image->bus_resource.name);
 		release_resource(&image->bus_resource);
-		memset(&image->bus_resource, 0, sizeof(struct resource));
+		memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 	}
 
 	/* Exit here if size is zero */
@@ -788,7 +788,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 	release_resource(&image->bus_resource);
 err_resource:
 	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(struct resource));
+	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 err_name:
 	return retval;
 }
@@ -802,7 +802,7 @@ static void tsi148_free_resource(struct vme_master_resource *image)
 	image->kern_base = NULL;
 	release_resource(&image->bus_resource);
 	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(struct resource));
+	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 }
 
 /*
@@ -1639,5 +1639,5 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
 	tsi148_bridge = list->parent->parent;
 
 	/* Descriptor must be aligned on 64-bit boundaries */
-	entry = kmalloc(sizeof(struct tsi148_dma_entry), GFP_KERNEL);
+	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
 	if (entry == NULL) {
@@ -1657,7 +1657,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
 	/* Given we are going to fill out the structure, we probably don't
 	 * need to zero it, but better safe than sorry for now.
 	 */
-	memset(&entry->descriptor, 0, sizeof(struct tsi148_dma_descriptor));
+	memset(&entry->descriptor, 0, sizeof(entry->descriptor));
 
 	/* Fill out source part */
 	switch (src->type) {
@@ -1752,8 +1752,9 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
 	list_add_tail(&entry->list, &list->entries);
 
 	entry->dma_handle = dma_map_single(tsi148_bridge->parent,
-		&entry->descriptor,
-		sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE);
+					   &entry->descriptor,
+					   sizeof(entry->descriptor),
+					   DMA_TO_DEVICE);
 	if (dma_mapping_error(tsi148_bridge->parent, entry->dma_handle)) {
 		dev_err(tsi148_bridge->parent, "DMA mapping error\n");
 		retval = -EINVAL;
@@ -2290,12 +2291,12 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* If we want to support more than one of each bridge, we need to
 	 * dynamically generate this so we get one per device
 	 */
-	tsi148_bridge = kzalloc(sizeof(struct vme_bridge), GFP_KERNEL);
+	tsi148_bridge = kzalloc(sizeof(*tsi148_bridge), GFP_KERNEL);
 	if (tsi148_bridge == NULL) {
 		retval = -ENOMEM;
 		goto err_struct;
 	}
 	vme_init_bridge(tsi148_bridge);
 
-	tsi148_device = kzalloc(sizeof(struct tsi148_driver), GFP_KERNEL);
+	tsi148_device = kzalloc(sizeof(*tsi148_device), GFP_KERNEL);
 	if (tsi148_device == NULL) {
@@ -2363,5 +2364,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		master_num--;
 
 		tsi148_device->flush_image =
-			kmalloc(sizeof(struct vme_master_resource), GFP_KERNEL);
+			kmalloc(sizeof(*tsi148_device->flush_image), GFP_KERNEL);
 		if (tsi148_device->flush_image == NULL) {
@@ -2373,12 +2374,11 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		tsi148_device->flush_image->locked = 1;
 		tsi148_device->flush_image->number = master_num;
 		memset(&tsi148_device->flush_image->bus_resource, 0,
-			sizeof(struct resource));
+		       sizeof(tsi148_device->flush_image->bus_resource));
 		tsi148_device->flush_image->kern_base  = NULL;
 	}
 
 	/* Add master windows to list */
 	for (i = 0; i < master_num; i++) {
-		master_image = kmalloc(sizeof(struct vme_master_resource),
-			GFP_KERNEL);
+		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
 		if (master_image == NULL) {
@@ -2398,7 +2398,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			VME_PROG | VME_DATA;
 		master_image->width_attr = VME_D16 | VME_D32;
 		memset(&master_image->bus_resource, 0,
-			sizeof(struct resource));
+		       sizeof(master_image->bus_resource));
 		master_image->kern_base  = NULL;
 		list_add_tail(&master_image->list,
 			&tsi148_bridge->master_resources);
@@ -2406,6 +2406,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Add slave windows to list */
 	for (i = 0; i < TSI148_MAX_SLAVE; i++) {
-		slave_image = kmalloc(sizeof(struct vme_slave_resource),
-			GFP_KERNEL);
+		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
 		if (slave_image == NULL) {
@@ -2428,6 +2427,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Add dma engines to list */
 	for (i = 0; i < TSI148_MAX_DMA; i++) {
-		dma_ctrlr = kmalloc(sizeof(struct vme_dma_resource),
-			GFP_KERNEL);
+		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
 		if (dma_ctrlr == NULL) {
@@ -2449,5 +2447,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	}
 
 	/* Add location monitor to list */
-	lm = kmalloc(sizeof(struct vme_lm_resource), GFP_KERNEL);
+	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
 	if (lm == NULL) {
-- 
2.14.0

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

* [PATCH 14/14] vme: tsi148: Adjust 14 checks for null pointers
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (12 preceding siblings ...)
  2017-08-25 16:15 ` [PATCH 13/14] vme: tsi148: Improve 17 size determinations SF Markus Elfring
@ 2017-08-25 16:17 ` SF Markus Elfring
  2017-08-25 21:50 ` [PATCH 00/14] VME: Adjustments for several function implementations Martyn Welch
  14 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-25 16:17 UTC (permalink / raw)
  To: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, Martyn Welch
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 25 Aug 2017 12:00:17 +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/vme/bridges/vme_tsi148.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index 61946f5d356f..cba9514605b7 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -748,9 +748,9 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 	if (size == 0)
 		return 0;
 
-	if (image->bus_resource.name == NULL) {
+	if (!image->bus_resource.name) {
 		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
-		if (image->bus_resource.name == NULL) {
+		if (!image->bus_resource.name) {
 			retval = -ENOMEM;
 			goto err_name;
 		}
@@ -776,7 +776,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 
 	image->kern_base = ioremap_nocache(
 		image->bus_resource.start, size);
-	if (image->kern_base == NULL) {
+	if (!image->kern_base) {
 		dev_err(tsi148_bridge->parent, "Failed to remap resource\n");
 		retval = -ENOMEM;
 		goto err_remap;
@@ -1640,7 +1640,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
 
 	/* Descriptor must be aligned on 64-bit boundaries */
 	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
-	if (entry == NULL) {
+	if (!entry) {
 		retval = -ENOMEM;
 		goto err_mem;
 	}
@@ -1943,7 +1943,7 @@ static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
 
 	/* If we already have a callback attached, we can't move it! */
 	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i] != NULL) {
+		if (bridge->lm_callback[i]) {
 			mutex_unlock(&lm->mtx);
 			dev_err(tsi148_bridge->parent, "Location monitor "
 				"callback attached, can't reset\n");
@@ -2068,7 +2068,7 @@ static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
 	}
 
 	/* Check that a callback isn't already attached */
-	if (bridge->lm_callback[monitor] != NULL) {
+	if (bridge->lm_callback[monitor]) {
 		mutex_unlock(&lm->mtx);
 		dev_err(tsi148_bridge->parent, "Existing callback attached\n");
 		return -EBUSY;
@@ -2205,7 +2205,7 @@ static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge,
 	/* Allocate mem for CR/CSR image */
 	bridge->crcsr_kernel = pci_zalloc_consistent(pdev, VME_CRCSR_BUF_SIZE,
 						     &bridge->crcsr_bus);
-	if (bridge->crcsr_kernel == NULL) {
+	if (!bridge->crcsr_kernel) {
 		dev_err(tsi148_bridge->parent, "Failed to allocate memory for "
 			"CR/CSR image\n");
 		return -ENOMEM;
@@ -2292,14 +2292,14 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	 * dynamically generate this so we get one per device
 	 */
 	tsi148_bridge = kzalloc(sizeof(*tsi148_bridge), GFP_KERNEL);
-	if (tsi148_bridge == NULL) {
+	if (!tsi148_bridge) {
 		retval = -ENOMEM;
 		goto err_struct;
 	}
 	vme_init_bridge(tsi148_bridge);
 
 	tsi148_device = kzalloc(sizeof(*tsi148_device), GFP_KERNEL);
-	if (tsi148_device == NULL) {
+	if (!tsi148_device) {
 		retval = -ENOMEM;
 		goto err_driver;
 	}
@@ -2365,7 +2365,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 		tsi148_device->flush_image =
 			kmalloc(sizeof(*tsi148_device->flush_image), GFP_KERNEL);
-		if (tsi148_device->flush_image == NULL) {
+		if (!tsi148_device->flush_image) {
 			retval = -ENOMEM;
 			goto err_master;
 		}
@@ -2381,7 +2381,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* Add master windows to list */
 	for (i = 0; i < master_num; i++) {
 		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
-		if (master_image == NULL) {
+		if (!master_image) {
 			retval = -ENOMEM;
 			goto err_master;
 		}
@@ -2407,7 +2407,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* Add slave windows to list */
 	for (i = 0; i < TSI148_MAX_SLAVE; i++) {
 		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
-		if (slave_image == NULL) {
+		if (!slave_image) {
 			retval = -ENOMEM;
 			goto err_slave;
 		}
@@ -2428,7 +2428,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* Add dma engines to list */
 	for (i = 0; i < TSI148_MAX_DMA; i++) {
 		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
-		if (dma_ctrlr == NULL) {
+		if (!dma_ctrlr) {
 			retval = -ENOMEM;
 			goto err_dma;
 		}
@@ -2448,7 +2448,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Add location monitor to list */
 	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
-	if (lm == NULL) {
+	if (!lm) {
 		retval = -ENOMEM;
 		goto err_lm;
 	}
-- 
2.14.0

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

* Re: [PATCH 13/14] vme: tsi148: Improve 17 size determinations
  2017-08-25 16:15 ` [PATCH 13/14] vme: tsi148: Improve 17 size determinations SF Markus Elfring
@ 2017-08-25 20:57   ` Martyn Welch
  2017-08-26  7:00     ` SF Markus Elfring
  0 siblings, 1 reply; 21+ messages in thread
From: Martyn Welch @ 2017-08-25 20:57 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, LKML, kernel-janitors

On Fri, Aug 25, 2017 at 06:15:08PM +0200, SF Markus Elfring wrote:

<snip>

> @@ -2363,5 +2364,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  		master_num--;
>  
>  		tsi148_device->flush_image =
> -			kmalloc(sizeof(struct vme_master_resource), GFP_KERNEL);
> +			kmalloc(sizeof(*tsi148_device->flush_image), GFP_KERNEL);

This line is now a tiny bit too long and needs to be broken over two lines.

Martyn

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

* Re: [PATCH 00/14] VME: Adjustments for several function implementations
  2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
                   ` (13 preceding siblings ...)
  2017-08-25 16:17 ` [PATCH 14/14] vme: tsi148: Adjust 14 checks for null pointers SF Markus Elfring
@ 2017-08-25 21:50 ` Martyn Welch
  2017-08-26  7:04   ` Greg Kroah-Hartman
  14 siblings, 1 reply; 21+ messages in thread
From: Martyn Welch @ 2017-08-25 21:50 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, LKML

On Fri, Aug 25, 2017 at 05:41:13PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 25 Aug 2017 13:15:43 +0200
> 
> Several update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (14):
>   Delete 11 error messages for a failed memory allocation
>   Improve 11 size determinations
>   Move an assignment in vme_new_dma_list()
>   Adjust 48 checks for null pointers
>   Return directly in two functions
>   fake: Delete an error message for a failed memory allocation in fake_init()
>   fake: Improve five size determinations in fake_init()
>   fake: Adjust 11 checks for null pointers
>   ca91cx42: Delete eight error messages for a failed memory allocation
>   ca91cx42: Improve 12 size determinations
>   ca91cx42: Adjust 14 checks for null pointers
>   tsi148: Delete nine error messages for a failed memory allocation
>   tsi148: Improve 17 size determinations
>   tsi148: Adjust 14 checks for null pointers
> 

Hi Markus,

Thanks for the patches. Other than the minor tweak needed to patch 13,
these are looking good to me.

Martyn

>  drivers/vme/bridges/vme_ca91cx42.c |  73 +++++---------
>  drivers/vme/bridges/vme_fake.c     |  35 +++----
>  drivers/vme/bridges/vme_tsi148.c   |  82 ++++++----------
>  drivers/vme/vme.c                  | 194 ++++++++++++++++---------------------
>  4 files changed, 156 insertions(+), 228 deletions(-)
> 
> -- 
> 2.14.0
> 

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

* Re: [PATCH 13/14] vme: tsi148: Improve 17 size determinations
  2017-08-25 20:57   ` Martyn Welch
@ 2017-08-26  7:00     ` SF Markus Elfring
  2017-08-30 19:47       ` Martyn Welch
  0 siblings, 1 reply; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-26  7:00 UTC (permalink / raw)
  To: Martyn Welch, devel
  Cc: Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, LKML, kernel-janitors

>> @@ -2363,5 +2364,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>  		master_num--;
>>  
>>  		tsi148_device->flush_image =
>> -			kmalloc(sizeof(struct vme_master_resource), GFP_KERNEL);
>> +			kmalloc(sizeof(*tsi148_device->flush_image), GFP_KERNEL);
> 
> This line is now a tiny bit too long

Can you eventually tolerate a line length of 81 characters at such a source code place?


> and needs to be broken over two lines.

How would like to achieve this?

* It seems that you would not like to perform such a tweak yourself.

* Do you expect a resend for the complete patch series?

* Will it be sufficient to send another patch only for the requested reformatting
  of a single line?

Regards,
Markus

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

* Re: [PATCH 00/14] VME: Adjustments for several function implementations
  2017-08-25 21:50 ` [PATCH 00/14] VME: Adjustments for several function implementations Martyn Welch
@ 2017-08-26  7:04   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-08-26  7:04 UTC (permalink / raw)
  To: Martyn Welch
  Cc: SF Markus Elfring, devel, Arnd Bergmann, Augusto Mecking Caringi,
	LKML, Alessio Igor Bogani, Baoyou Xie, Manohar Vanga

On Fri, Aug 25, 2017 at 10:50:19PM +0100, Martyn Welch wrote:
> On Fri, Aug 25, 2017 at 05:41:13PM +0200, SF Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Fri, 25 Aug 2017 13:15:43 +0200
> > 
> > Several update suggestions were taken into account
> > from static source code analysis.
> > 
> > Markus Elfring (14):
> >   Delete 11 error messages for a failed memory allocation
> >   Improve 11 size determinations
> >   Move an assignment in vme_new_dma_list()
> >   Adjust 48 checks for null pointers
> >   Return directly in two functions
> >   fake: Delete an error message for a failed memory allocation in fake_init()
> >   fake: Improve five size determinations in fake_init()
> >   fake: Adjust 11 checks for null pointers
> >   ca91cx42: Delete eight error messages for a failed memory allocation
> >   ca91cx42: Improve 12 size determinations
> >   ca91cx42: Adjust 14 checks for null pointers
> >   tsi148: Delete nine error messages for a failed memory allocation
> >   tsi148: Improve 17 size determinations
> >   tsi148: Adjust 14 checks for null pointers
> > 
> 
> Hi Markus,
> 
> Thanks for the patches. Other than the minor tweak needed to patch 13,
> these are looking good to me.

You do know this developer is in my kill-file and I refuse to take
patches from them, and strongly recommend that everyone else just ignore
them, right?  Also many other maintainers/developers have done the same
to them over time due to their past history.

It's up to you what you want to do, but the only way I'll ever accept
patches from them is if they come through someone else (i.e. you resend
them to me...)

good luck!

greg k-h

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

* Re: [PATCH 13/14] vme: tsi148: Improve 17 size determinations
  2017-08-26  7:00     ` SF Markus Elfring
@ 2017-08-30 19:47       ` Martyn Welch
  2017-08-30 20:56         ` SF Markus Elfring
  0 siblings, 1 reply; 21+ messages in thread
From: Martyn Welch @ 2017-08-30 19:47 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: devel, Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, LKML, kernel-janitors

On 26 August 2017 at 08:00, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
>>> @@ -2363,5 +2364,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>              master_num--;
>>>
>>>              tsi148_device->flush_image =
>>> -                    kmalloc(sizeof(struct vme_master_resource), GFP_KERNEL);
>>> +                    kmalloc(sizeof(*tsi148_device->flush_image), GFP_KERNEL);
>>
>> This line is now a tiny bit too long
>
> Can you eventually tolerate a line length of 81 characters at such a source code place?
>

I think there's some irony here. On the one hand you are submitting
patches that correct coding style issues, on the other you are asking
whether we can ignore the coding style...

>
>> and needs to be broken over two lines.
>
> How would like to achieve this?
>
> * It seems that you would not like to perform such a tweak yourself.
>

To be honest, it is quicker and easier in this instance to do just
that. So that's now done.

Patches now in my testing branch:

https://gitlab.collabora.com/martyn/linux/commits/vme-testing

For future reference:

> * Do you expect a resend for the complete patch series?
>

Unless the maintainer has commented that they have accepted patches x,
y and z, then sending the entire series again is generally the right
thing to do.

> * Will it be sufficient to send another patch only for the requested reformatting
>   of a single line?
>

No, unless the patches have been accepted as-is.

Martyn

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

* Re: [PATCH 13/14] vme: tsi148: Improve 17 size determinations
  2017-08-30 19:47       ` Martyn Welch
@ 2017-08-30 20:56         ` SF Markus Elfring
  0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-08-30 20:56 UTC (permalink / raw)
  To: Martyn Welch, devel
  Cc: Aaron Sierra, Alessio Igor Bogani, Arnd Bergmann,
	Augusto Mecking Caringi, Baoyou Xie, Greg Kroah-Hartman,
	Manohar Vanga, LKML, kernel-janitors

>>>> @@ -2363,5 +2364,5 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>>>>              master_num--;
>>>>
>>>>              tsi148_device->flush_image =
>>>> -                    kmalloc(sizeof(struct vme_master_resource), GFP_KERNEL);
>>>> +                    kmalloc(sizeof(*tsi148_device->flush_image), GFP_KERNEL);
>>>
>>> This line is now a tiny bit too long
>>
>> Can you eventually tolerate a line length of 81 characters at such a source code place?
>>
> 
> I think there's some irony here. On the one hand you are submitting
> patches that correct coding style issues, on the other you are asking
> whether we can ignore the coding style...

I test somehow how strict you would like to handle the length limit there.

I imagine that the affected source code formatting could also become different
if the involved variable name would be shorter.


>> * It seems that you would not like to perform such a tweak yourself.
> 
> To be honest, it is quicker and easier in this instance to do just that.

Interesting …


> So that's now done.

Thanks that you picked some of my ideas up.


> Patches now in my testing branch:
> 
> https://gitlab.collabora.com/martyn/linux/commits/vme-testing

I am curious on how the shown change possibilities will evolve from
this repository.


>> * Do you expect a resend for the complete patch series?
>>
> 
> Unless the maintainer has commented that they have accepted patches x,
> y and z, then sending the entire series again is generally the right
> thing to do.

Would you like to respond further to Greg's comments (from 2017-08-26)
for this patch series?

Regards,
Markus

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

end of thread, other threads:[~2017-08-30 20:57 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 15:41 [PATCH 00/14] VME: Adjustments for several function implementations SF Markus Elfring
2017-08-25 15:51 ` [PATCH 01/14] vme: Delete 11 error messages for a failed memory allocation SF Markus Elfring
2017-08-25 15:53 ` [PATCH 02/14] vme: Improve 11 size determinations SF Markus Elfring
2017-08-25 15:57 ` [PATCH 03/14] vme: Move an assignment in vme_new_dma_list() SF Markus Elfring
2017-08-25 15:59 ` [PATCH 04/14] vme: Adjust 48 checks for null pointers SF Markus Elfring
2017-08-25 16:00 ` [PATCH 05/14] vme: Return directly in two functions SF Markus Elfring
2017-08-25 16:02 ` [PATCH 06/14] vme: fake: Delete an error message for a failed memory allocation in fake_init() SF Markus Elfring
2017-08-25 16:03 ` [PATCH 07/14] vme: fake: Improve five size determinations " SF Markus Elfring
2017-08-25 16:05 ` [PATCH 08/14] vme: fake: Adjust 11 checks for null pointers SF Markus Elfring
2017-08-25 16:06 ` [PATCH 09/14] vme: ca91cx42: Delete eight error messages for a failed memory allocation SF Markus Elfring
2017-08-25 16:08 ` [PATCH 10/14] vme: ca91cx42: Improve 12 size determinations SF Markus Elfring
2017-08-25 16:10 ` [PATCH 11/14] vme: ca91cx42: Adjust 14 checks for null pointers SF Markus Elfring
2017-08-25 16:13 ` [PATCH 12/14] vme: tsi148: Delete nine error messages for a failed memory allocation SF Markus Elfring
2017-08-25 16:15 ` [PATCH 13/14] vme: tsi148: Improve 17 size determinations SF Markus Elfring
2017-08-25 20:57   ` Martyn Welch
2017-08-26  7:00     ` SF Markus Elfring
2017-08-30 19:47       ` Martyn Welch
2017-08-30 20:56         ` SF Markus Elfring
2017-08-25 16:17 ` [PATCH 14/14] vme: tsi148: Adjust 14 checks for null pointers SF Markus Elfring
2017-08-25 21:50 ` [PATCH 00/14] VME: Adjustments for several function implementations Martyn Welch
2017-08-26  7:04   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).