* [PATCH 0/2] oprofile_perf: Adjustments for oprofile_perf_init()
@ 2017-05-13 16:32 SF Markus Elfring
2017-05-13 16:33 ` [PATCH 1/2] oprofile_perf: Improve a size determination in oprofile_perf_init() SF Markus Elfring
2017-05-13 16:35 ` [PATCH 2/2] oprofile_perf: Delete error messages for a failed memory allocation " SF Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-05-13 16:32 UTC (permalink / raw)
To: oprofile-list, Robert Richter; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 13 May 2017 18:28:38 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Improve a size determination
Delete error messages for a failed memory allocation
drivers/oprofile/oprofile_perf.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
--
2.12.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] oprofile_perf: Improve a size determination in oprofile_perf_init()
2017-05-13 16:32 [PATCH 0/2] oprofile_perf: Adjustments for oprofile_perf_init() SF Markus Elfring
@ 2017-05-13 16:33 ` SF Markus Elfring
2017-05-13 16:35 ` [PATCH 2/2] oprofile_perf: Delete error messages for a failed memory allocation " SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-05-13 16:33 UTC (permalink / raw)
To: oprofile-list, Robert Richter; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 13 May 2017 18:00:13 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/oprofile/oprofile_perf.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index d5b2732b1b81..033f2c26f2ad 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -285,7 +285,6 @@ int __init oprofile_perf_init(struct oprofile_operations *ops)
goto out;
}
- counter_config = kcalloc(num_counters,
- sizeof(struct op_counter_config), GFP_KERNEL);
-
+ counter_config = kcalloc(num_counters, sizeof(*counter_config),
+ GFP_KERNEL);
if (!counter_config) {
--
2.12.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] oprofile_perf: Delete error messages for a failed memory allocation in oprofile_perf_init()
2017-05-13 16:32 [PATCH 0/2] oprofile_perf: Adjustments for oprofile_perf_init() SF Markus Elfring
2017-05-13 16:33 ` [PATCH 1/2] oprofile_perf: Improve a size determination in oprofile_perf_init() SF Markus Elfring
@ 2017-05-13 16:35 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-05-13 16:35 UTC (permalink / raw)
To: oprofile-list, Robert Richter; +Cc: LKML, kernel-janitors, Wolfram Sang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 13 May 2017 18:08:07 +0200
Omit extra messages for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/oprofile/oprofile_perf.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index 033f2c26f2ad..6de27b90b562 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -291,5 +291,3 @@ int __init oprofile_perf_init(struct oprofile_operations *ops)
- pr_info("oprofile: failed to allocate %d "
- "counters\n", num_counters);
ret = -ENOMEM;
num_counters = 0;
goto out;
@@ -299,8 +297,6 @@ int __init oprofile_perf_init(struct oprofile_operations *ops)
per_cpu(perf_events, cpu) = kcalloc(num_counters,
sizeof(struct perf_event *), GFP_KERNEL);
if (!per_cpu(perf_events, cpu)) {
- pr_info("oprofile: failed to allocate %d perf events "
- "for cpu %d\n", num_counters, cpu);
ret = -ENOMEM;
goto out;
}
--
2.12.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-13 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-13 16:32 [PATCH 0/2] oprofile_perf: Adjustments for oprofile_perf_init() SF Markus Elfring
2017-05-13 16:33 ` [PATCH 1/2] oprofile_perf: Improve a size determination in oprofile_perf_init() SF Markus Elfring
2017-05-13 16:35 ` [PATCH 2/2] oprofile_perf: Delete error messages for a failed memory allocation " SF Markus Elfring
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).