All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ACPI: Adjustments for six function implementations
@ 2017-09-29 20:15 ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-09-29 20:15 UTC (permalink / raw)
  To: linux-acpi, Len Brown, Rafael J. Wysocki, Zhang Rui; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 29 Sep 2017 22:10:22 +0200

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

Markus Elfring (2):
  Delete an error message for a failed memory allocation in five functions
  scan: Improve a size determination in three functions

 drivers/acpi/acpi_platform.c |  1 -
 drivers/acpi/acpi_video.c    |  1 -
 drivers/acpi/ioapic.c        |  1 -
 drivers/acpi/scan.c          | 11 ++++-------
 4 files changed, 4 insertions(+), 10 deletions(-)

-- 
2.14.2


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

* [PATCH 0/2] ACPI: Adjustments for six function implementations
@ 2017-09-29 20:15 ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-09-29 20:15 UTC (permalink / raw)
  To: linux-acpi, Len Brown, Rafael J. Wysocki, Zhang Rui; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 29 Sep 2017 22:10:22 +0200

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

Markus Elfring (2):
  Delete an error message for a failed memory allocation in five functions
  scan: Improve a size determination in three functions

 drivers/acpi/acpi_platform.c |  1 -
 drivers/acpi/acpi_video.c    |  1 -
 drivers/acpi/ioapic.c        |  1 -
 drivers/acpi/scan.c          | 11 ++++-------
 4 files changed, 4 insertions(+), 10 deletions(-)

-- 
2.14.2


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

* [PATCH 1/2] ACPI: Delete an error message for a failed memory allocation in five functions
  2017-09-29 20:15 ` SF Markus Elfring
@ 2017-09-29 20:17   ` SF Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-09-29 20:17 UTC (permalink / raw)
  To: linux-acpi, Len Brown, Rafael J. Wysocki, Zhang Rui; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 29 Sep 2017 21:52:44 +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/acpi/acpi_platform.c | 1 -
 drivers/acpi/acpi_video.c    | 1 -
 drivers/acpi/ioapic.c        | 1 -
 drivers/acpi/scan.c          | 5 +----
 4 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 88cd949003f3..9ca1fa1806ae 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -85,7 +85,6 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
 		resources = kzalloc(count * sizeof(struct resource),
 				    GFP_KERNEL);
 		if (!resources) {
-			dev_err(&adev->dev, "No memory for resources\n");
 			acpi_dev_free_resource_list(&resource_list);
 			return ERR_PTR(-ENOMEM);
 		}
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 0972ec0e2eb8..0160f237d963 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -822,7 +822,6 @@ int acpi_video_get_levels(struct acpi_device *device,
 
 	br = kzalloc(sizeof(*br), GFP_KERNEL);
 	if (!br) {
-		printk(KERN_ERR "can't allocate memory\n");
 		result = -ENOMEM;
 		goto out;
 	}
diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index 3595aa9c7c18..99d7c69eae9b 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -124,7 +124,6 @@ static acpi_status handle_ioapic_add(acpi_handle handle, u32 lvl,
 
 	ioapic = kzalloc(sizeof(*ioapic), GFP_KERNEL);
 	if (!ioapic) {
-		pr_err("cannot allocate memory for new IOAPIC\n");
 		goto exit;
 	} else {
 		ioapic->root_handle = (acpi_handle)context;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 602f8ff212f2..7df7bea1e177 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -652,7 +652,6 @@ int acpi_device_add(struct acpi_device *device,
 
 	new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
 	if (!new_bus_id) {
-		pr_err(PREFIX "Memory allocation error\n");
 		result = -ENOMEM;
 		goto err_detach;
 	}
@@ -1579,10 +1578,8 @@ static int acpi_add_single_object(struct acpi_device **child,
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
 	device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
-	if (!device) {
-		printk(KERN_ERR PREFIX "Memory allocation error\n");
+	if (!device)
 		return -ENOMEM;
-	}
 
 	acpi_init_device_object(device, handle, type, sta);
 	acpi_bus_get_power_flags(device);
-- 
2.14.2


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

* [PATCH 1/2] ACPI: Delete an error message for a failed memory allocation in five functions
@ 2017-09-29 20:17   ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-09-29 20:17 UTC (permalink / raw)
  To: linux-acpi, Len Brown, Rafael J. Wysocki, Zhang Rui; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 29 Sep 2017 21:52:44 +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/acpi/acpi_platform.c | 1 -
 drivers/acpi/acpi_video.c    | 1 -
 drivers/acpi/ioapic.c        | 1 -
 drivers/acpi/scan.c          | 5 +----
 4 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 88cd949003f3..9ca1fa1806ae 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -85,7 +85,6 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
 		resources = kzalloc(count * sizeof(struct resource),
 				    GFP_KERNEL);
 		if (!resources) {
-			dev_err(&adev->dev, "No memory for resources\n");
 			acpi_dev_free_resource_list(&resource_list);
 			return ERR_PTR(-ENOMEM);
 		}
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 0972ec0e2eb8..0160f237d963 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -822,7 +822,6 @@ int acpi_video_get_levels(struct acpi_device *device,
 
 	br = kzalloc(sizeof(*br), GFP_KERNEL);
 	if (!br) {
-		printk(KERN_ERR "can't allocate memory\n");
 		result = -ENOMEM;
 		goto out;
 	}
diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index 3595aa9c7c18..99d7c69eae9b 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -124,7 +124,6 @@ static acpi_status handle_ioapic_add(acpi_handle handle, u32 lvl,
 
 	ioapic = kzalloc(sizeof(*ioapic), GFP_KERNEL);
 	if (!ioapic) {
-		pr_err("cannot allocate memory for new IOAPIC\n");
 		goto exit;
 	} else {
 		ioapic->root_handle = (acpi_handle)context;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 602f8ff212f2..7df7bea1e177 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -652,7 +652,6 @@ int acpi_device_add(struct acpi_device *device,
 
 	new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
 	if (!new_bus_id) {
-		pr_err(PREFIX "Memory allocation error\n");
 		result = -ENOMEM;
 		goto err_detach;
 	}
@@ -1579,10 +1578,8 @@ static int acpi_add_single_object(struct acpi_device **child,
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
 	device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
-	if (!device) {
-		printk(KERN_ERR PREFIX "Memory allocation error\n");
+	if (!device)
 		return -ENOMEM;
-	}
 
 	acpi_init_device_object(device, handle, type, sta);
 	acpi_bus_get_power_flags(device);
-- 
2.14.2


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

* [PATCH 2/2] ACPI-scan: Improve a size determination in three functions
  2017-09-29 20:15 ` SF Markus Elfring
@ 2017-09-29 20:18   ` SF Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-09-29 20:18 UTC (permalink / raw)
  To: linux-acpi, Len Brown, Rafael J. Wysocki, Zhang Rui; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 29 Sep 2017 22:00:25 +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/acpi/scan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7df7bea1e177..34bc7274dc8e 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -650,7 +650,7 @@ int acpi_device_add(struct acpi_device *device,
 	INIT_LIST_HEAD(&device->del_list);
 	mutex_init(&device->physical_node_lock);
 
-	new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
+	new_bus_id = kzalloc(sizeof(*new_bus_id), GFP_KERNEL);
 	if (!new_bus_id) {
 		result = -ENOMEM;
 		goto err_detach;
@@ -1577,7 +1577,7 @@ static int acpi_add_single_object(struct acpi_device **child,
 	struct acpi_device *device;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
-	device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
+	device = kzalloc(sizeof(*device), GFP_KERNEL);
 	if (!device)
 		return -ENOMEM;
 
@@ -1786,7 +1786,7 @@ static void acpi_device_dep_initialize(struct acpi_device *adev)
 		if (skip)
 			continue;
 
-		dep = kzalloc(sizeof(struct acpi_dep_data), GFP_KERNEL);
+		dep = kzalloc(sizeof(*dep), GFP_KERNEL);
 		if (!dep)
 			return;
 
-- 
2.14.2

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

* [PATCH 2/2] ACPI-scan: Improve a size determination in three functions
@ 2017-09-29 20:18   ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-09-29 20:18 UTC (permalink / raw)
  To: linux-acpi, Len Brown, Rafael J. Wysocki, Zhang Rui; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 29 Sep 2017 22:00:25 +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/acpi/scan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7df7bea1e177..34bc7274dc8e 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -650,7 +650,7 @@ int acpi_device_add(struct acpi_device *device,
 	INIT_LIST_HEAD(&device->del_list);
 	mutex_init(&device->physical_node_lock);
 
-	new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
+	new_bus_id = kzalloc(sizeof(*new_bus_id), GFP_KERNEL);
 	if (!new_bus_id) {
 		result = -ENOMEM;
 		goto err_detach;
@@ -1577,7 +1577,7 @@ static int acpi_add_single_object(struct acpi_device **child,
 	struct acpi_device *device;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
-	device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
+	device = kzalloc(sizeof(*device), GFP_KERNEL);
 	if (!device)
 		return -ENOMEM;
 
@@ -1786,7 +1786,7 @@ static void acpi_device_dep_initialize(struct acpi_device *adev)
 		if (skip)
 			continue;
 
-		dep = kzalloc(sizeof(struct acpi_dep_data), GFP_KERNEL);
+		dep = kzalloc(sizeof(*dep), GFP_KERNEL);
 		if (!dep)
 			return;
 
-- 
2.14.2


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

end of thread, other threads:[~2017-09-29 20:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 20:15 [PATCH 0/2] ACPI: Adjustments for six function implementations SF Markus Elfring
2017-09-29 20:15 ` SF Markus Elfring
2017-09-29 20:17 ` [PATCH 1/2] ACPI: Delete an error message for a failed memory allocation in five functions SF Markus Elfring
2017-09-29 20:17   ` SF Markus Elfring
2017-09-29 20:18 ` [PATCH 2/2] ACPI-scan: Improve a size determination in three functions SF Markus Elfring
2017-09-29 20:18   ` 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.