From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-s390@vger.kernel.org,
David Hildenbrand <dahi@linux.vnet.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Joe Perches <joe@perches.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Julia Lawall <julia.lawall@lip6.fr>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 02/17] s390/debug: Delete unnecessary braces
Date: Sat, 3 Sep 2016 14:13:03 +0200 [thread overview]
Message-ID: <502fe4ad-d627-2f8d-e1e6-a45bcd8e0ce2@users.sourceforge.net> (raw)
In-Reply-To: <e4359dc9-9e20-e33b-9743-9ebade853268@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 1 Sep 2016 15:06:06 +0200
Do not use curly brackets at some source code places
where a single statement should be sufficient.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/s390/kernel/debug.c | 48 ++++++++++++++++--------------------------------
1 file changed, 16 insertions(+), 32 deletions(-)
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 8e2be30..ddfc5e4 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -203,15 +203,13 @@ debug_areas_alloc(int pages_per_area, int nr_areas)
areas[i] = kmalloc_array(pages_per_area,
sizeof(*areas[i]),
GFP_KERNEL);
- if (!areas[i]) {
+ if (!areas[i])
goto fail_malloc_areas2;
- }
for(j = 0; j < pages_per_area; j++) {
areas[i][j] = kzalloc(PAGE_SIZE, GFP_KERNEL);
if(!areas[i][j]) {
- for(j--; j >=0 ; j--) {
+ for (j--; j >= 0; j--)
kfree(areas[i][j]);
- }
kfree(areas[i]);
goto fail_malloc_areas2;
}
@@ -221,9 +219,8 @@ debug_areas_alloc(int pages_per_area, int nr_areas)
fail_malloc_areas2:
for(i--; i >= 0; i--){
- for(j=0; j < pages_per_area;j++){
+ for (j = 0; j < pages_per_area; j++)
kfree(areas[i][j]);
- }
kfree(areas[i]);
}
kfree(areas);
@@ -303,9 +300,8 @@ debug_areas_free(debug_info_t* db_info)
if(!db_info->areas)
return;
for (i = 0; i < db_info->nr_areas; i++) {
- for(j = 0; j < db_info->pages_per_area; j++) {
+ for (j = 0; j < db_info->pages_per_area; j++)
kfree(db_info->areas[i][j]);
- }
kfree(db_info->areas[i]);
}
kfree(db_info->areas);
@@ -396,11 +392,9 @@ debug_info_copy(debug_info_t* in, int mode)
if (mode == NO_AREAS)
goto out;
- for(i = 0; i < in->nr_areas; i++){
- for(j = 0; j < in->pages_per_area; j++) {
+ for (i = 0; i < in->nr_areas; i++)
+ for (j = 0; j < in->pages_per_area; j++)
memcpy(rc->areas[i][j], in->areas[i][j],PAGE_SIZE);
- }
- }
out:
spin_unlock_irqrestore(&in->lock, flags);
return rc;
@@ -711,9 +705,8 @@ debug_info_t *debug_register_mode(const char *name, int pages_per_area,
debug_register_view(rc, &debug_flush_view);
debug_register_view(rc, &debug_pages_view);
out:
- if (!rc){
+ if (!rc)
pr_err("Registering debug feature %s failed\n", name);
- }
mutex_unlock(&debug_mutex);
return rc;
}
@@ -1005,10 +998,9 @@ debug_count_numargs(char *string)
{
int numargs=0;
- while(*string) {
+ while (*string)
if(*string++=='%')
numargs++;
- }
return(numargs);
}
@@ -1114,10 +1106,9 @@ debug_register_view(debug_info_t * id, struct debug_view *view)
goto out;
}
spin_lock_irqsave(&id->lock, flags);
- for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
+ for (i = 0; i < DEBUG_MAX_VIEWS; i++)
if (!id->views[i])
break;
- }
if (i == DEBUG_MAX_VIEWS) {
pr_err("Registering view %s/%s would exceed the maximum "
"number of views %i\n", id->name, view->name, i);
@@ -1148,10 +1139,9 @@ debug_unregister_view(debug_info_t * id, struct debug_view *view)
if (!id)
goto out;
spin_lock_irqsave(&id->lock, flags);
- for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
+ for (i = 0; i < DEBUG_MAX_VIEWS; i++)
if (id->views[i] == view)
break;
- }
if (i == DEBUG_MAX_VIEWS)
rc = -1;
else {
@@ -1193,9 +1183,8 @@ debug_get_uint(char *buf)
buf = skip_spaces(buf);
rc = simple_strtoul(buf, &buf, 10);
- if(*buf){
+ if (*buf)
rc = -EINVAL;
- }
return rc;
}
@@ -1265,12 +1254,10 @@ debug_prolog_level_fn(debug_info_t * id, struct debug_view *view, char *out_buf)
{
int rc = 0;
- if(id->level == DEBUG_OFF_LEVEL) {
+ if (id->level == DEBUG_OFF_LEVEL)
rc = sprintf(out_buf,"-\n");
- }
- else {
+ else
rc = sprintf(out_buf, "%i\n", id->level);
- }
return rc;
}
@@ -1336,16 +1323,14 @@ static void debug_flush(debug_info_t* id, int area)
memset(id->active_entries, 0, id->nr_areas * sizeof(int));
for (i = 0; i < id->nr_areas; i++) {
id->active_pages[i] = 0;
- for(j = 0; j < id->pages_per_area; j++) {
+ for (j = 0; j < id->pages_per_area; j++)
memset(id->areas[i][j], 0, PAGE_SIZE);
- }
}
} else if(area >= 0 && area < id->nr_areas) {
id->active_entries[area] = 0;
id->active_pages[area] = 0;
- for(i = 0; i < id->pages_per_area; i++) {
+ for (i = 0; i < id->pages_per_area; i++)
memset(id->areas[area][i],0,PAGE_SIZE);
- }
}
spin_unlock_irqrestore(&id->lock,flags);
}
@@ -1430,10 +1415,9 @@ debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view,
{
int i, rc = 0;
- for (i = 0; i < id->buf_size; i++) {
+ for (i = 0; i < id->buf_size; i++)
rc += sprintf(out_buf + rc, "%02x ",
((unsigned char *) in_buf)[i]);
- }
rc += sprintf(out_buf + rc, "| ");
for (i = 0; i < id->buf_size; i++) {
unsigned char c = in_buf[i];
--
2.9.3
next prev parent reply other threads:[~2016-09-03 12:13 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <566ABCD9.1060404@users.sourceforge.net>
2016-01-03 10:00 ` [PATCH 0/2] 390/qeth: Fine-tuning for qeth_core_set_online() SF Markus Elfring
2016-01-03 10:02 ` [PATCH 1/2] 390/qeth: Delete an unnecessary variable initialisation in qeth_core_set_online() SF Markus Elfring
2016-01-04 11:29 ` Heiko Carstens
2016-01-07 14:33 ` Ursula Braun
2016-01-08 7:18 ` SF Markus Elfring
2016-01-08 8:25 ` Ursula Braun
2016-01-08 12:00 ` SF Markus Elfring
2016-01-03 10:02 ` [PATCH 2/2] 390/qeth: Refactoring for qeth_core_set_online() SF Markus Elfring
2016-01-04 11:30 ` Heiko Carstens
2016-01-04 13:10 ` SF Markus Elfring
2016-01-04 14:04 ` Heiko Carstens
2016-01-04 14:10 ` SF Markus Elfring
2016-01-05 7:54 ` Heiko Carstens
2016-08-20 17:32 ` [PATCH] s390/tape: Use memdup_user() rather than duplicating its implementation SF Markus Elfring
2016-08-22 6:24 ` Martin Schwidefsky
2016-09-03 12:04 ` [PATCH 00/17] s390/debug: Fine-tuning for several function implementations SF Markus Elfring
2016-09-03 12:10 ` [PATCH 01/17] s390/debug: Use kmalloc_array() in debug_areas_alloc() SF Markus Elfring
2016-09-03 12:13 ` SF Markus Elfring [this message]
2016-09-03 12:14 ` [PATCH 03/17] s390/debug: Add some spaces for better code readability SF Markus Elfring
2016-09-03 12:16 ` [PATCH 04/17] s390/debug: Rename jump labels in debug_areas_alloc() SF Markus Elfring
2016-09-03 12:18 ` [PATCH 05/17] s390/debug: Fix jump targets in debug_info_alloc() SF Markus Elfring
2016-09-03 12:20 ` [PATCH 06/17] s390/debug: Rename jump labels in debug_info_copy() SF Markus Elfring
2016-09-03 12:21 ` [PATCH 07/17] s390/debug: Rename jump labels in debug_open() SF Markus Elfring
2016-09-03 12:23 ` [PATCH 08/17] s390/debug: Fix a jump target in debug_register_mode() SF Markus Elfring
2016-09-03 12:24 ` [PATCH 09/17] s390/debug: Return directly if a null pointer was passed to debug_unregister() SF Markus Elfring
2016-09-03 12:42 ` walter harms
2016-09-03 12:26 ` [PATCH 10/17] s390/debug: Delete an unnecessary initialisation in debug_prolog_level_fn() SF Markus Elfring
2016-09-03 12:28 ` [PATCH 11/17] s390/debug: Fix indentation in 13 functions SF Markus Elfring
2016-09-03 12:30 ` [PATCH 12/17] s390/debug: Use memdup_user() rather than duplicating its implementation SF Markus Elfring
2016-09-03 13:10 ` kbuild test robot
2016-09-03 12:32 ` [PATCH 13/17] s390/debug: Improve a size determination in debug_open() SF Markus Elfring
2016-09-03 12:34 ` [PATCH 14/17] s390/debug: Improve a size determination in debug_sprintf_format_fn() SF Markus Elfring
2016-09-03 12:36 ` [PATCH 15/17] s390/debug: Improve a size determination in debug_raw_header_fn() SF Markus Elfring
2016-09-03 12:38 ` [PATCH 16/17] s390/debug: Improve determination of sizes in debug_info_alloc() SF Markus Elfring
2016-09-03 12:40 ` [PATCH 17/17] s390/debug: Improve another size determination " SF Markus Elfring
2016-09-05 10:31 ` [PATCH 00/17] s390/debug: Fine-tuning for several function implementations Martin Schwidefsky
2016-09-05 10:40 ` SF Markus Elfring
2016-09-09 16:50 ` SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=502fe4ad-d627-2f8d-e1e6-a45bcd8e0ce2@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=dahi@linux.vnet.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=joe@perches.com \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).