* [PATCH 0/8] MMC-core: Fine-tuning for some function implementations
@ 2017-01-08 21:38 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:38 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 22:30:03 +0100
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (8):
Use kmalloc_array() in mmc_test_area_init()
Fix a typo in a comment line
Use seq_puts() in mtf_testlist_show()
mmc_test: Add some spaces for better code readability
mmc_test: Combine substrings for 5 messages
mmc_test: Improve a size determination in five functions
Use kcalloc() in mmc_test_alloc_mem()
Use kmalloc_array() in mmc_alloc_sg()
drivers/mmc/core/mmc_test.c | 77 +++++++++++++++++++++------------------------
drivers/mmc/core/queue.c | 2 +-
2 files changed, 36 insertions(+), 43 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 0/8] MMC-core: Fine-tuning for some function implementations
@ 2017-01-08 21:38 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:38 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 22:30:03 +0100
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (8):
Use kmalloc_array() in mmc_test_area_init()
Fix a typo in a comment line
Use seq_puts() in mtf_testlist_show()
mmc_test: Add some spaces for better code readability
mmc_test: Combine substrings for 5 messages
mmc_test: Improve a size determination in five functions
Use kcalloc() in mmc_test_alloc_mem()
Use kmalloc_array() in mmc_alloc_sg()
drivers/mmc/core/mmc_test.c | 77 +++++++++++++++++++++------------------------
drivers/mmc/core/queue.c | 2 +-
2 files changed, 36 insertions(+), 43 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:42 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:42 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 18:44:26 +0100
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
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/mmc/core/mmc_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 3ab6e52d106c..e85ef503d7ce 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -1579,7 +1579,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
if (!t->mem)
return -ENOMEM;
- t->sg = kmalloc(sizeof(struct scatterlist) * t->max_segs, GFP_KERNEL);
+ t->sg = kmalloc_array(t->max_segs, sizeof(*t->sg), GFP_KERNEL);
if (!t->sg) {
ret = -ENOMEM;
goto out_free;
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
@ 2017-01-08 21:42 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:42 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 18:44:26 +0100
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
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/mmc/core/mmc_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 3ab6e52d106c..e85ef503d7ce 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -1579,7 +1579,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
if (!t->mem)
return -ENOMEM;
- t->sg = kmalloc(sizeof(struct scatterlist) * t->max_segs, GFP_KERNEL);
+ t->sg = kmalloc_array(t->max_segs, sizeof(*t->sg), GFP_KERNEL);
if (!t->sg) {
ret = -ENOMEM;
goto out_free;
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 2/8] mmc-core: Fix a typo in a comment line
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:43 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:43 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors, trivial
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 19:05:37 +0100
Add a missing character in the function description.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index e85ef503d7ce..2f838a13a904 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -1533,7 +1533,7 @@ static int mmc_test_area_cleanup(struct mmc_test_card *test)
/*
* Initialize an area for testing large transfers. The test area is set to the
- * middle of the card because cards may have different charateristics at the
+ * middle of the card because cards may have different characteristics at the
* front (for FAT file system optimization). Optionally, the area is erased
* (if the card supports it) which may improve write performance. Optionally,
* the area is filled with data for subsequent read tests.
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 2/8] mmc-core: Fix a typo in a comment line
@ 2017-01-08 21:43 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:43 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors, trivial
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 19:05:37 +0100
Add a missing character in the function description.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index e85ef503d7ce..2f838a13a904 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -1533,7 +1533,7 @@ static int mmc_test_area_cleanup(struct mmc_test_card *test)
/*
* Initialize an area for testing large transfers. The test area is set to the
- * middle of the card because cards may have different charateristics at the
+ * middle of the card because cards may have different characteristics at the
* front (for FAT file system optimization). Optionally, the area is erased
* (if the card supports it) which may improve write performance. Optionally,
* the area is filled with data for subsequent read tests.
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 3/8] mmc-core: Use seq_puts() in mtf_testlist_show()
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:45 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:45 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 19:48:28 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: Prefer seq_puts to seq_printf
Thus fix the affected source code place.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 2f838a13a904..848f4f30e343 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -3163,7 +3163,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
mutex_lock(&mmc_test_lock);
- seq_printf(sf, "0:\tRun all tests\n");
+ seq_puts(sf, "0:\tRun all tests\n");
for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 3/8] mmc-core: Use seq_puts() in mtf_testlist_show()
@ 2017-01-08 21:45 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:45 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 19:48:28 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: Prefer seq_puts to seq_printf
Thus fix the affected source code place.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 2f838a13a904..848f4f30e343 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -3163,7 +3163,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
mutex_lock(&mmc_test_lock);
- seq_printf(sf, "0:\tRun all tests\n");
+ seq_puts(sf, "0:\tRun all tests\n");
for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:46 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:46 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 20:25:39 +0100
Use space characters at some source code places according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 848f4f30e343..42aefd3df09b 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -641,11 +641,11 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)
if (write)
memset(test->buffer, 0xDF, 512);
else {
- for (i = 0;i < 512;i++)
+ for (i = 0; i < 512; i++)
test->buffer[i] = i;
}
- for (i = 0;i < BUFFER_SIZE / 512;i++) {
+ for (i = 0; i < BUFFER_SIZE / 512; i++) {
ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
if (ret)
return ret;
@@ -674,7 +674,7 @@ static int mmc_test_cleanup(struct mmc_test_card *test)
memset(test->buffer, 0, 512);
- for (i = 0;i < BUFFER_SIZE / 512;i++) {
+ for (i = 0; i < BUFFER_SIZE / 512; i++) {
ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
if (ret)
return ret;
@@ -946,7 +946,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
unsigned long flags;
if (write) {
- for (i = 0;i < blocks * blksz;i++)
+ for (i = 0; i < blocks * blksz; i++)
test->scratch[i] = i;
} else {
memset(test->scratch, 0, BUFFER_SIZE);
@@ -980,7 +980,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
memset(test->buffer, 0, sectors * 512);
- for (i = 0;i < sectors;i++) {
+ for (i = 0; i < sectors; i++) {
ret = mmc_test_buffer_transfer(test,
test->buffer + i * 512,
dev_addr + i, 512, 0);
@@ -988,12 +988,12 @@ static int mmc_test_transfer(struct mmc_test_card *test,
return ret;
}
- for (i = 0;i < blocks * blksz;i++) {
+ for (i = 0; i < blocks * blksz; i++) {
if (test->buffer[i] != (u8)i)
return RESULT_FAIL;
}
- for (;i < sectors * 512;i++) {
+ for (; i < sectors * 512; i++) {
if (test->buffer[i] != 0xDF)
return RESULT_FAIL;
}
@@ -1001,7 +1001,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
local_irq_save(flags);
sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
local_irq_restore(flags);
- for (i = 0;i < blocks * blksz;i++) {
+ for (i = 0; i < blocks * blksz; i++) {
if (test->scratch[i] != (u8)i)
return RESULT_FAIL;
}
@@ -1086,7 +1086,7 @@ static int mmc_test_multi_write(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, size);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
}
static int mmc_test_multi_read(struct mmc_test_card *test)
@@ -1107,7 +1107,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, size);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
}
static int mmc_test_pow2_write(struct mmc_test_card *test)
@@ -1118,7 +1118,7 @@ static int mmc_test_pow2_write(struct mmc_test_card *test)
if (!test->card->csd.write_partial)
return RESULT_UNSUP_CARD;
- for (i = 1; i < 512;i <<= 1) {
+ for (i = 1; i < 512; i <<= 1) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
if (ret)
@@ -1136,7 +1136,7 @@ static int mmc_test_pow2_read(struct mmc_test_card *test)
if (!test->card->csd.read_partial)
return RESULT_UNSUP_CARD;
- for (i = 1; i < 512;i <<= 1) {
+ for (i = 1; i < 512; i <<= 1) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
if (ret)
@@ -1154,7 +1154,7 @@ static int mmc_test_weird_write(struct mmc_test_card *test)
if (!test->card->csd.write_partial)
return RESULT_UNSUP_CARD;
- for (i = 3; i < 512;i += 7) {
+ for (i = 3; i < 512; i += 7) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
if (ret)
@@ -1172,7 +1172,7 @@ static int mmc_test_weird_read(struct mmc_test_card *test)
if (!test->card->csd.read_partial)
return RESULT_UNSUP_CARD;
- for (i = 3; i < 512;i += 7) {
+ for (i = 3; i < 512; i += 7) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
if (ret)
@@ -1231,7 +1231,7 @@ static int mmc_test_align_multi_write(struct mmc_test_card *test)
for (i = 1; i < TEST_ALIGN_END; i++) {
sg_init_one(&sg, test->buffer + i, size);
- ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
+ ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
if (ret)
return ret;
}
@@ -1258,7 +1258,7 @@ static int mmc_test_align_multi_read(struct mmc_test_card *test)
for (i = 1; i < TEST_ALIGN_END; i++) {
sg_init_one(&sg, test->buffer + i, size);
- ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
+ ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
if (ret)
return ret;
}
@@ -1357,7 +1357,7 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test)
sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, size, 0);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
}
static int mmc_test_multi_read_high(struct mmc_test_card *test)
@@ -1379,7 +1379,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test)
sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, size, 0);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
}
#else
@@ -2147,7 +2147,7 @@ static int mmc_test_rw_multiple_sg_len(struct mmc_test_card *test,
int i;
for (i = 0 ; i < rw->len && ret == 0; i++) {
- ret = mmc_test_rw_multiple(test, rw, 512*1024, rw->size,
+ ret = mmc_test_rw_multiple(test, rw, 512 * 1024, rw->size,
rw->sg_len[i]);
if (ret)
break;
@@ -2954,7 +2954,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
mmc_claim_host(test->card->host);
- for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) {
+ for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++) {
struct mmc_test_general_result *gr;
if (testcase && ((i + 1) != testcase))
@@ -3165,7 +3165,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
seq_puts(sf, "0:\tRun all tests\n");
for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
- seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
+ seq_printf(sf, "%d:\t%s\n", i + 1, mmc_test_cases[i].name);
mutex_unlock(&mmc_test_lock);
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability
@ 2017-01-08 21:46 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:46 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 20:25:39 +0100
Use space characters at some source code places according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 848f4f30e343..42aefd3df09b 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -641,11 +641,11 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)
if (write)
memset(test->buffer, 0xDF, 512);
else {
- for (i = 0;i < 512;i++)
+ for (i = 0; i < 512; i++)
test->buffer[i] = i;
}
- for (i = 0;i < BUFFER_SIZE / 512;i++) {
+ for (i = 0; i < BUFFER_SIZE / 512; i++) {
ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
if (ret)
return ret;
@@ -674,7 +674,7 @@ static int mmc_test_cleanup(struct mmc_test_card *test)
memset(test->buffer, 0, 512);
- for (i = 0;i < BUFFER_SIZE / 512;i++) {
+ for (i = 0; i < BUFFER_SIZE / 512; i++) {
ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
if (ret)
return ret;
@@ -946,7 +946,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
unsigned long flags;
if (write) {
- for (i = 0;i < blocks * blksz;i++)
+ for (i = 0; i < blocks * blksz; i++)
test->scratch[i] = i;
} else {
memset(test->scratch, 0, BUFFER_SIZE);
@@ -980,7 +980,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
memset(test->buffer, 0, sectors * 512);
- for (i = 0;i < sectors;i++) {
+ for (i = 0; i < sectors; i++) {
ret = mmc_test_buffer_transfer(test,
test->buffer + i * 512,
dev_addr + i, 512, 0);
@@ -988,12 +988,12 @@ static int mmc_test_transfer(struct mmc_test_card *test,
return ret;
}
- for (i = 0;i < blocks * blksz;i++) {
+ for (i = 0; i < blocks * blksz; i++) {
if (test->buffer[i] != (u8)i)
return RESULT_FAIL;
}
- for (;i < sectors * 512;i++) {
+ for (; i < sectors * 512; i++) {
if (test->buffer[i] != 0xDF)
return RESULT_FAIL;
}
@@ -1001,7 +1001,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
local_irq_save(flags);
sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
local_irq_restore(flags);
- for (i = 0;i < blocks * blksz;i++) {
+ for (i = 0; i < blocks * blksz; i++) {
if (test->scratch[i] != (u8)i)
return RESULT_FAIL;
}
@@ -1086,7 +1086,7 @@ static int mmc_test_multi_write(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, size);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
}
static int mmc_test_multi_read(struct mmc_test_card *test)
@@ -1107,7 +1107,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test)
sg_init_one(&sg, test->buffer, size);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
}
static int mmc_test_pow2_write(struct mmc_test_card *test)
@@ -1118,7 +1118,7 @@ static int mmc_test_pow2_write(struct mmc_test_card *test)
if (!test->card->csd.write_partial)
return RESULT_UNSUP_CARD;
- for (i = 1; i < 512;i <<= 1) {
+ for (i = 1; i < 512; i <<= 1) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
if (ret)
@@ -1136,7 +1136,7 @@ static int mmc_test_pow2_read(struct mmc_test_card *test)
if (!test->card->csd.read_partial)
return RESULT_UNSUP_CARD;
- for (i = 1; i < 512;i <<= 1) {
+ for (i = 1; i < 512; i <<= 1) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
if (ret)
@@ -1154,7 +1154,7 @@ static int mmc_test_weird_write(struct mmc_test_card *test)
if (!test->card->csd.write_partial)
return RESULT_UNSUP_CARD;
- for (i = 3; i < 512;i += 7) {
+ for (i = 3; i < 512; i += 7) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
if (ret)
@@ -1172,7 +1172,7 @@ static int mmc_test_weird_read(struct mmc_test_card *test)
if (!test->card->csd.read_partial)
return RESULT_UNSUP_CARD;
- for (i = 3; i < 512;i += 7) {
+ for (i = 3; i < 512; i += 7) {
sg_init_one(&sg, test->buffer, i);
ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
if (ret)
@@ -1231,7 +1231,7 @@ static int mmc_test_align_multi_write(struct mmc_test_card *test)
for (i = 1; i < TEST_ALIGN_END; i++) {
sg_init_one(&sg, test->buffer + i, size);
- ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
+ ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
if (ret)
return ret;
}
@@ -1258,7 +1258,7 @@ static int mmc_test_align_multi_read(struct mmc_test_card *test)
for (i = 1; i < TEST_ALIGN_END; i++) {
sg_init_one(&sg, test->buffer + i, size);
- ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
+ ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
if (ret)
return ret;
}
@@ -1357,7 +1357,7 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test)
sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, size, 0);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
}
static int mmc_test_multi_read_high(struct mmc_test_card *test)
@@ -1379,7 +1379,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test)
sg_init_table(&sg, 1);
sg_set_page(&sg, test->highmem, size, 0);
- return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
+ return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
}
#else
@@ -2147,7 +2147,7 @@ static int mmc_test_rw_multiple_sg_len(struct mmc_test_card *test,
int i;
for (i = 0 ; i < rw->len && ret = 0; i++) {
- ret = mmc_test_rw_multiple(test, rw, 512*1024, rw->size,
+ ret = mmc_test_rw_multiple(test, rw, 512 * 1024, rw->size,
rw->sg_len[i]);
if (ret)
break;
@@ -2954,7 +2954,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
mmc_claim_host(test->card->host);
- for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) {
+ for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++) {
struct mmc_test_general_result *gr;
if (testcase && ((i + 1) != testcase))
@@ -3165,7 +3165,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
seq_puts(sf, "0:\tRun all tests\n");
for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
- seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
+ seq_printf(sf, "%d:\t%s\n", i + 1, mmc_test_cases[i].name);
mutex_unlock(&mmc_test_lock);
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:47 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:47 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 20:56:48 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: quoted string split across lines
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 42aefd3df09b..bb9f569a5dd5 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -277,8 +277,7 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
if (!busy && mmc_test_busy(&cmd)) {
busy = 1;
if (test->card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)
- pr_info("%s: Warning: Host did not "
- "wait for busy state to end.\n",
+ pr_info("%s: Warning: Host did not wait for busy state to end.\n",
mmc_hostname(test->card->host));
}
} while (mmc_test_busy(&cmd));
@@ -2967,8 +2966,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
if (mmc_test_cases[i].prepare) {
ret = mmc_test_cases[i].prepare(test);
if (ret) {
- pr_info("%s: Result: Prepare "
- "stage failed! (%d)\n",
+ pr_info("%s: Result: Prepare stage failed! (%d)\n",
mmc_hostname(test->card->host),
ret);
continue;
@@ -3005,13 +3003,11 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
mmc_hostname(test->card->host));
break;
case RESULT_UNSUP_HOST:
- pr_info("%s: Result: UNSUPPORTED "
- "(by host)\n",
+ pr_info("%s: Result: UNSUPPORTED (by host)\n",
mmc_hostname(test->card->host));
break;
case RESULT_UNSUP_CARD:
- pr_info("%s: Result: UNSUPPORTED "
- "(by card)\n",
+ pr_info("%s: Result: UNSUPPORTED (by card)\n",
mmc_hostname(test->card->host));
break;
default:
@@ -3026,8 +3022,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
if (mmc_test_cases[i].cleanup) {
ret = mmc_test_cases[i].cleanup(test);
if (ret) {
- pr_info("%s: Warning: Cleanup "
- "stage failed! (%d)\n",
+ pr_info("%s: Warning: Cleanup stage failed! (%d)\n",
mmc_hostname(test->card->host),
ret);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages
@ 2017-01-08 21:47 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:47 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 20:56:48 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: quoted string split across lines
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mmc/core/mmc_test.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 42aefd3df09b..bb9f569a5dd5 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -277,8 +277,7 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
if (!busy && mmc_test_busy(&cmd)) {
busy = 1;
if (test->card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)
- pr_info("%s: Warning: Host did not "
- "wait for busy state to end.\n",
+ pr_info("%s: Warning: Host did not wait for busy state to end.\n",
mmc_hostname(test->card->host));
}
} while (mmc_test_busy(&cmd));
@@ -2967,8 +2966,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
if (mmc_test_cases[i].prepare) {
ret = mmc_test_cases[i].prepare(test);
if (ret) {
- pr_info("%s: Result: Prepare "
- "stage failed! (%d)\n",
+ pr_info("%s: Result: Prepare stage failed! (%d)\n",
mmc_hostname(test->card->host),
ret);
continue;
@@ -3005,13 +3003,11 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
mmc_hostname(test->card->host));
break;
case RESULT_UNSUP_HOST:
- pr_info("%s: Result: UNSUPPORTED "
- "(by host)\n",
+ pr_info("%s: Result: UNSUPPORTED (by host)\n",
mmc_hostname(test->card->host));
break;
case RESULT_UNSUP_CARD:
- pr_info("%s: Result: UNSUPPORTED "
- "(by card)\n",
+ pr_info("%s: Result: UNSUPPORTED (by card)\n",
mmc_hostname(test->card->host));
break;
default:
@@ -3026,8 +3022,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
if (mmc_test_cases[i].cleanup) {
ret = mmc_test_cases[i].cleanup(test);
if (ret) {
- pr_info("%s: Warning: Cleanup "
- "stage failed! (%d)\n",
+ pr_info("%s: Warning: Cleanup stage failed! (%d)\n",
mmc_hostname(test->card->host),
ret);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:49 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:49 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 21:25:44 +0100
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/mmc/core/mmc_test.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index bb9f569a5dd5..294d3c675734 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -356,7 +356,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
if (max_segs > max_page_cnt)
max_segs = max_page_cnt;
- mem = kzalloc(sizeof(struct mmc_test_mem), GFP_KERNEL);
+ mem = kzalloc(sizeof(*mem), GFP_KERNEL);
if (!mem)
return NULL;
@@ -545,7 +545,7 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test,
if (!test->gr)
return;
- tr = kmalloc(sizeof(struct mmc_test_transfer_result), GFP_KERNEL);
+ tr = kmalloc(sizeof(*tr), GFP_KERNEL);
if (!tr)
return;
@@ -2973,8 +2973,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
}
}
- gr = kzalloc(sizeof(struct mmc_test_general_result),
- GFP_KERNEL);
+ gr = kzalloc(sizeof(*gr), GFP_KERNEL);
if (gr) {
INIT_LIST_HEAD(&gr->tr_lst);
@@ -3108,7 +3107,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
if (ret)
return ret;
- test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
+ test = kzalloc(sizeof(*test), GFP_KERNEL);
if (!test)
return -ENOMEM;
@@ -3213,7 +3212,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
return -ENODEV;
}
- df = kmalloc(sizeof(struct mmc_test_dbgfs_file), GFP_KERNEL);
+ df = kmalloc(sizeof(*df), GFP_KERNEL);
if (!df) {
debugfs_remove(file);
dev_err(&card->dev,
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions
@ 2017-01-08 21:49 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:49 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 21:25:44 +0100
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/mmc/core/mmc_test.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index bb9f569a5dd5..294d3c675734 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -356,7 +356,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
if (max_segs > max_page_cnt)
max_segs = max_page_cnt;
- mem = kzalloc(sizeof(struct mmc_test_mem), GFP_KERNEL);
+ mem = kzalloc(sizeof(*mem), GFP_KERNEL);
if (!mem)
return NULL;
@@ -545,7 +545,7 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test,
if (!test->gr)
return;
- tr = kmalloc(sizeof(struct mmc_test_transfer_result), GFP_KERNEL);
+ tr = kmalloc(sizeof(*tr), GFP_KERNEL);
if (!tr)
return;
@@ -2973,8 +2973,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
}
}
- gr = kzalloc(sizeof(struct mmc_test_general_result),
- GFP_KERNEL);
+ gr = kzalloc(sizeof(*gr), GFP_KERNEL);
if (gr) {
INIT_LIST_HEAD(&gr->tr_lst);
@@ -3108,7 +3107,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
if (ret)
return ret;
- test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
+ test = kzalloc(sizeof(*test), GFP_KERNEL);
if (!test)
return -ENOMEM;
@@ -3213,7 +3212,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
return -ENODEV;
}
- df = kmalloc(sizeof(struct mmc_test_dbgfs_file), GFP_KERNEL);
+ df = kmalloc(sizeof(*df), GFP_KERNEL);
if (!df) {
debugfs_remove(file);
dev_err(&card->dev,
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem()
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:50 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:50 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 21:43:12 +0100
* The script "checkpatch.pl" pointed information out like the following.
WARNING: Prefer kcalloc over kzalloc with multiply
Thus fix the affected source code place.
* Replace the specification of a data structure by a pointer dereference
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/mmc/core/mmc_test.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 294d3c675734..cb4750de2720 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -360,8 +360,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
if (!mem)
return NULL;
- mem->arr = kzalloc(sizeof(struct mmc_test_pages) * max_segs,
- GFP_KERNEL);
+ mem->arr = kcalloc(max_segs, sizeof(*mem->arr), GFP_KERNEL);
if (!mem->arr)
goto out_free;
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem()
@ 2017-01-08 21:50 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:50 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 21:43:12 +0100
* The script "checkpatch.pl" pointed information out like the following.
WARNING: Prefer kcalloc over kzalloc with multiply
Thus fix the affected source code place.
* Replace the specification of a data structure by a pointer dereference
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/mmc/core/mmc_test.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 294d3c675734..cb4750de2720 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -360,8 +360,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
if (!mem)
return NULL;
- mem->arr = kzalloc(sizeof(struct mmc_test_pages) * max_segs,
- GFP_KERNEL);
+ mem->arr = kcalloc(max_segs, sizeof(*mem->arr), GFP_KERNEL);
if (!mem->arr)
goto out_free;
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg()
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-08 21:55 ` SF Markus Elfring
-1 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:55 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 22:10:40 +0100
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
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/mmc/core/queue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index a6496d8027bc..b1986622c60e 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -152,7 +152,7 @@ static struct scatterlist *mmc_alloc_sg(int sg_len, int *err)
{
struct scatterlist *sg;
- sg = kmalloc(sizeof(struct scatterlist)*sg_len, GFP_KERNEL);
+ sg = kmalloc_array(sg_len, sizeof(*sg), GFP_KERNEL);
if (!sg)
*err = -ENOMEM;
else {
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg()
@ 2017-01-08 21:55 ` SF Markus Elfring
0 siblings, 0 replies; 56+ messages in thread
From: SF Markus Elfring @ 2017-01-08 21:55 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 8 Jan 2017 22:10:40 +0100
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
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/mmc/core/queue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index a6496d8027bc..b1986622c60e 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -152,7 +152,7 @@ static struct scatterlist *mmc_alloc_sg(int sg_len, int *err)
{
struct scatterlist *sg;
- sg = kmalloc(sizeof(struct scatterlist)*sg_len, GFP_KERNEL);
+ sg = kmalloc_array(sg_len, sizeof(*sg), GFP_KERNEL);
if (!sg)
*err = -ENOMEM;
else {
--
2.11.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
2017-01-08 21:42 ` SF Markus Elfring
@ 2017-01-09 18:31 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:31 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:42 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 18:44:26 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> 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>
Chunyan has been running this test code so she might have additional
insights to provide. I am not aware about anyone else really running the
tests, are there people who do it?
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
@ 2017-01-09 18:31 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:31 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:42 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 18:44:26 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> 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>
Chunyan has been running this test code so she might have additional
insights to provide. I am not aware about anyone else really running the
tests, are there people who do it?
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 2/8] mmc-core: Fix a typo in a comment line
2017-01-08 21:43 ` SF Markus Elfring
@ 2017-01-09 18:32 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:32 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors, Jiri Kosina
On Sun, Jan 8, 2017 at 10:43 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:05:37 +0100
>
> Add a missing character in the function description.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 2/8] mmc-core: Fix a typo in a comment line
@ 2017-01-09 18:32 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:32 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors, Jiri Kosina
On Sun, Jan 8, 2017 at 10:43 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:05:37 +0100
>
> Add a missing character in the function description.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 3/8] mmc-core: Use seq_puts() in mtf_testlist_show()
2017-01-08 21:45 ` SF Markus Elfring
@ 2017-01-09 18:33 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:33 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:45 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:48:28 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer seq_puts to seq_printf
>
> Thus fix the affected source code place.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 3/8] mmc-core: Use seq_puts() in mtf_testlist_show()
@ 2017-01-09 18:33 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:33 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:45 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:48:28 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer seq_puts to seq_printf
>
> Thus fix the affected source code place.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability
2017-01-08 21:46 ` SF Markus Elfring
@ 2017-01-09 18:34 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:34 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:46 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:25:39 +0100
>
> Use space characters at some source code places according to
> the Linux coding style convention.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
OK then.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability
@ 2017-01-09 18:34 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:34 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:46 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:25:39 +0100
>
> Use space characters at some source code places according to
> the Linux coding style convention.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
OK then.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages
2017-01-08 21:47 ` SF Markus Elfring
@ 2017-01-09 18:35 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:35 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:47 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:56:48 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: quoted string split across lines
>
> Thus fix affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages
@ 2017-01-09 18:35 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:35 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:47 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:56:48 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: quoted string split across lines
>
> Thus fix affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions
2017-01-08 21:49 ` SF Markus Elfring
@ 2017-01-09 18:35 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:35 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:49 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:25:44 +0100
>
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions
@ 2017-01-09 18:35 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:35 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:49 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:25:44 +0100
>
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem()
2017-01-08 21:50 ` SF Markus Elfring
@ 2017-01-09 18:36 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:36 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:50 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:43:12 +0100
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer kcalloc over kzalloc with multiply
>
> Thus fix the affected source code place.
>
> * Replace the specification of a data structure by a pointer dereference
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem()
@ 2017-01-09 18:36 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:36 UTC (permalink / raw)
To: SF Markus Elfring, Chunyan Zhang
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:50 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:43:12 +0100
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer kcalloc over kzalloc with multiply
>
> Thus fix the affected source code place.
>
> * Replace the specification of a data structure by a pointer dereference
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg()
2017-01-08 21:55 ` SF Markus Elfring
@ 2017-01-09 18:37 ` Linus Walleij
-1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:37 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:55 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 22:10:40 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg()
@ 2017-01-09 18:37 ` Linus Walleij
0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:37 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang, LKML,
kernel-janitors
On Sun, Jan 8, 2017 at 10:55 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 22:10:40 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
2017-01-09 18:31 ` Linus Walleij
@ 2017-01-10 7:37 ` Chunyan Zhang
-1 siblings, 0 replies; 56+ messages in thread
From: Chunyan Zhang @ 2017-01-10 7:37 UTC (permalink / raw)
To: Linus Walleij
Cc: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang,
LKML, kernel-janitors
On 10 January 2017 at 02:31, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sun, Jan 8, 2017 at 10:42 PM, SF Markus Elfring
> <elfring@users.sourceforge.net> wrote:
>
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Sun, 8 Jan 2017 18:44:26 +0100
>>
>> * A multiplication for the size determination of a memory allocation
>> indicated that an array data structure should be processed.
>> Thus use the corresponding function "kmalloc_array".
>>
>> This issue was detected by using the Coccinelle software.
>>
>> * Replace the specification of a data structure by a pointer dereference
>> 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>
>
> Chunyan has been running this test code so she might have additional
> insights to provide. I am not aware about anyone else really running the
> tests, are there people who do it?
I talked about mmc_test on #armlinux channel with a person whose
nickname was s84 other day. It seemed that s84 was also trying to use
mmc_test module.
Regards,
Chunyan
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
@ 2017-01-10 7:37 ` Chunyan Zhang
0 siblings, 0 replies; 56+ messages in thread
From: Chunyan Zhang @ 2017-01-10 7:37 UTC (permalink / raw)
To: Linus Walleij
Cc: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Mike Christie, Shawn Lin, Ulf Hansson, Wolfram Sang,
LKML, kernel-janitors
On 10 January 2017 at 02:31, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sun, Jan 8, 2017 at 10:42 PM, SF Markus Elfring
> <elfring@users.sourceforge.net> wrote:
>
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Sun, 8 Jan 2017 18:44:26 +0100
>>
>> * A multiplication for the size determination of a memory allocation
>> indicated that an array data structure should be processed.
>> Thus use the corresponding function "kmalloc_array".
>>
>> This issue was detected by using the Coccinelle software.
>>
>> * Replace the specification of a data structure by a pointer dereference
>> 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>
>
> Chunyan has been running this test code so she might have additional
> insights to provide. I am not aware about anyone else really running the
> tests, are there people who do it?
I talked about mmc_test on #armlinux channel with a person whose
nickname was s84 other day. It seemed that s84 was also trying to use
mmc_test module.
Regards,
Chunyan
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg()
2017-01-08 21:55 ` SF Markus Elfring
@ 2017-01-10 8:27 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:27 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:55, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 22:10:40 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> to make the corresponding size determination a bit safer according to
> the Linux coding style convention.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/queue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index a6496d8027bc..b1986622c60e 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -152,7 +152,7 @@ static struct scatterlist *mmc_alloc_sg(int sg_len, int *err)
> {
> struct scatterlist *sg;
>
> - sg = kmalloc(sizeof(struct scatterlist)*sg_len, GFP_KERNEL);
> + sg = kmalloc_array(sg_len, sizeof(*sg), GFP_KERNEL);
> if (!sg)
> *err = -ENOMEM;
> else {
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg()
@ 2017-01-10 8:27 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:27 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:55, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 22:10:40 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> to make the corresponding size determination a bit safer according to
> the Linux coding style convention.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/queue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index a6496d8027bc..b1986622c60e 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -152,7 +152,7 @@ static struct scatterlist *mmc_alloc_sg(int sg_len, int *err)
> {
> struct scatterlist *sg;
>
> - sg = kmalloc(sizeof(struct scatterlist)*sg_len, GFP_KERNEL);
> + sg = kmalloc_array(sg_len, sizeof(*sg), GFP_KERNEL);
> if (!sg)
> *err = -ENOMEM;
> else {
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem()
2017-01-08 21:50 ` SF Markus Elfring
@ 2017-01-10 8:28 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:28 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:50, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:43:12 +0100
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer kcalloc over kzalloc with multiply
>
> Thus fix the affected source code place.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> * Replace the specification of a data structure by a pointer dereference
> 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/mmc/core/mmc_test.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 294d3c675734..cb4750de2720 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -360,8 +360,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
> if (!mem)
> return NULL;
>
> - mem->arr = kzalloc(sizeof(struct mmc_test_pages) * max_segs,
> - GFP_KERNEL);
> + mem->arr = kcalloc(max_segs, sizeof(*mem->arr), GFP_KERNEL);
> if (!mem->arr)
> goto out_free;
>
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem()
@ 2017-01-10 8:28 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:28 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:50, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:43:12 +0100
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer kcalloc over kzalloc with multiply
>
> Thus fix the affected source code place.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> * Replace the specification of a data structure by a pointer dereference
> 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/mmc/core/mmc_test.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 294d3c675734..cb4750de2720 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -360,8 +360,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
> if (!mem)
> return NULL;
>
> - mem->arr = kzalloc(sizeof(struct mmc_test_pages) * max_segs,
> - GFP_KERNEL);
> + mem->arr = kcalloc(max_segs, sizeof(*mem->arr), GFP_KERNEL);
> if (!mem->arr)
> goto out_free;
>
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions
2017-01-08 21:49 ` SF Markus Elfring
@ 2017-01-10 8:31 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:31 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:49, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:25:44 +0100
>
> 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.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index bb9f569a5dd5..294d3c675734 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -356,7 +356,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
> if (max_segs > max_page_cnt)
> max_segs = max_page_cnt;
>
> - mem = kzalloc(sizeof(struct mmc_test_mem), GFP_KERNEL);
> + mem = kzalloc(sizeof(*mem), GFP_KERNEL);
> if (!mem)
> return NULL;
>
> @@ -545,7 +545,7 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test,
> if (!test->gr)
> return;
>
> - tr = kmalloc(sizeof(struct mmc_test_transfer_result), GFP_KERNEL);
> + tr = kmalloc(sizeof(*tr), GFP_KERNEL);
> if (!tr)
> return;
>
> @@ -2973,8 +2973,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> }
> }
>
> - gr = kzalloc(sizeof(struct mmc_test_general_result),
> - GFP_KERNEL);
> + gr = kzalloc(sizeof(*gr), GFP_KERNEL);
> if (gr) {
> INIT_LIST_HEAD(&gr->tr_lst);
>
> @@ -3108,7 +3107,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
> if (ret)
> return ret;
>
> - test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
> + test = kzalloc(sizeof(*test), GFP_KERNEL);
> if (!test)
> return -ENOMEM;
>
> @@ -3213,7 +3212,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
> return -ENODEV;
> }
>
> - df = kmalloc(sizeof(struct mmc_test_dbgfs_file), GFP_KERNEL);
> + df = kmalloc(sizeof(*df), GFP_KERNEL);
> if (!df) {
> debugfs_remove(file);
> dev_err(&card->dev,
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions
@ 2017-01-10 8:31 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:31 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:49, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 21:25:44 +0100
>
> 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.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index bb9f569a5dd5..294d3c675734 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -356,7 +356,7 @@ static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz,
> if (max_segs > max_page_cnt)
> max_segs = max_page_cnt;
>
> - mem = kzalloc(sizeof(struct mmc_test_mem), GFP_KERNEL);
> + mem = kzalloc(sizeof(*mem), GFP_KERNEL);
> if (!mem)
> return NULL;
>
> @@ -545,7 +545,7 @@ static void mmc_test_save_transfer_result(struct mmc_test_card *test,
> if (!test->gr)
> return;
>
> - tr = kmalloc(sizeof(struct mmc_test_transfer_result), GFP_KERNEL);
> + tr = kmalloc(sizeof(*tr), GFP_KERNEL);
> if (!tr)
> return;
>
> @@ -2973,8 +2973,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> }
> }
>
> - gr = kzalloc(sizeof(struct mmc_test_general_result),
> - GFP_KERNEL);
> + gr = kzalloc(sizeof(*gr), GFP_KERNEL);
> if (gr) {
> INIT_LIST_HEAD(&gr->tr_lst);
>
> @@ -3108,7 +3107,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
> if (ret)
> return ret;
>
> - test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
> + test = kzalloc(sizeof(*test), GFP_KERNEL);
> if (!test)
> return -ENOMEM;
>
> @@ -3213,7 +3212,7 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
> return -ENODEV;
> }
>
> - df = kmalloc(sizeof(struct mmc_test_dbgfs_file), GFP_KERNEL);
> + df = kmalloc(sizeof(*df), GFP_KERNEL);
> if (!df) {
> debugfs_remove(file);
> dev_err(&card->dev,
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages
2017-01-08 21:47 ` SF Markus Elfring
@ 2017-01-10 8:34 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:34 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:47, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:56:48 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: quoted string split across lines
>
yup, the print shouldn't blindly split itself to shut up
"WARNING: line over 80 characters" . FWIW,
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Thus fix affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 42aefd3df09b..bb9f569a5dd5 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -277,8 +277,7 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
> if (!busy && mmc_test_busy(&cmd)) {
> busy = 1;
> if (test->card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)
> - pr_info("%s: Warning: Host did not "
> - "wait for busy state to end.\n",
> + pr_info("%s: Warning: Host did not wait for busy state to end.\n",
> mmc_hostname(test->card->host));
> }
> } while (mmc_test_busy(&cmd));
> @@ -2967,8 +2966,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> if (mmc_test_cases[i].prepare) {
> ret = mmc_test_cases[i].prepare(test);
> if (ret) {
> - pr_info("%s: Result: Prepare "
> - "stage failed! (%d)\n",
> + pr_info("%s: Result: Prepare stage failed! (%d)\n",
> mmc_hostname(test->card->host),
> ret);
> continue;
> @@ -3005,13 +3003,11 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> mmc_hostname(test->card->host));
> break;
> case RESULT_UNSUP_HOST:
> - pr_info("%s: Result: UNSUPPORTED "
> - "(by host)\n",
> + pr_info("%s: Result: UNSUPPORTED (by host)\n",
> mmc_hostname(test->card->host));
> break;
> case RESULT_UNSUP_CARD:
> - pr_info("%s: Result: UNSUPPORTED "
> - "(by card)\n",
> + pr_info("%s: Result: UNSUPPORTED (by card)\n",
> mmc_hostname(test->card->host));
> break;
> default:
> @@ -3026,8 +3022,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> if (mmc_test_cases[i].cleanup) {
> ret = mmc_test_cases[i].cleanup(test);
> if (ret) {
> - pr_info("%s: Warning: Cleanup "
> - "stage failed! (%d)\n",
> + pr_info("%s: Warning: Cleanup stage failed! (%d)\n",
> mmc_hostname(test->card->host),
> ret);
> }
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages
@ 2017-01-10 8:34 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:34 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:47, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:56:48 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: quoted string split across lines
>
yup, the print shouldn't blindly split itself to shut up
"WARNING: line over 80 characters" . FWIW,
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Thus fix affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 42aefd3df09b..bb9f569a5dd5 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -277,8 +277,7 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
> if (!busy && mmc_test_busy(&cmd)) {
> busy = 1;
> if (test->card->host->caps & MMC_CAP_WAIT_WHILE_BUSY)
> - pr_info("%s: Warning: Host did not "
> - "wait for busy state to end.\n",
> + pr_info("%s: Warning: Host did not wait for busy state to end.\n",
> mmc_hostname(test->card->host));
> }
> } while (mmc_test_busy(&cmd));
> @@ -2967,8 +2966,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> if (mmc_test_cases[i].prepare) {
> ret = mmc_test_cases[i].prepare(test);
> if (ret) {
> - pr_info("%s: Result: Prepare "
> - "stage failed! (%d)\n",
> + pr_info("%s: Result: Prepare stage failed! (%d)\n",
> mmc_hostname(test->card->host),
> ret);
> continue;
> @@ -3005,13 +3003,11 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> mmc_hostname(test->card->host));
> break;
> case RESULT_UNSUP_HOST:
> - pr_info("%s: Result: UNSUPPORTED "
> - "(by host)\n",
> + pr_info("%s: Result: UNSUPPORTED (by host)\n",
> mmc_hostname(test->card->host));
> break;
> case RESULT_UNSUP_CARD:
> - pr_info("%s: Result: UNSUPPORTED "
> - "(by card)\n",
> + pr_info("%s: Result: UNSUPPORTED (by card)\n",
> mmc_hostname(test->card->host));
> break;
> default:
> @@ -3026,8 +3022,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
> if (mmc_test_cases[i].cleanup) {
> ret = mmc_test_cases[i].cleanup(test);
> if (ret) {
> - pr_info("%s: Warning: Cleanup "
> - "stage failed! (%d)\n",
> + pr_info("%s: Warning: Cleanup stage failed! (%d)\n",
> mmc_hostname(test->card->host),
> ret);
> }
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability
2017-01-08 21:46 ` SF Markus Elfring
@ 2017-01-10 8:35 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:35 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:46, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:25:39 +0100
>
> Use space characters at some source code places according to
> the Linux coding style convention.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 42 +++++++++++++++++++++---------------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 848f4f30e343..42aefd3df09b 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -641,11 +641,11 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)
> if (write)
> memset(test->buffer, 0xDF, 512);
> else {
> - for (i = 0;i < 512;i++)
> + for (i = 0; i < 512; i++)
> test->buffer[i] = i;
> }
>
> - for (i = 0;i < BUFFER_SIZE / 512;i++) {
> + for (i = 0; i < BUFFER_SIZE / 512; i++) {
> ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
> if (ret)
> return ret;
> @@ -674,7 +674,7 @@ static int mmc_test_cleanup(struct mmc_test_card *test)
>
> memset(test->buffer, 0, 512);
>
> - for (i = 0;i < BUFFER_SIZE / 512;i++) {
> + for (i = 0; i < BUFFER_SIZE / 512; i++) {
> ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
> if (ret)
> return ret;
> @@ -946,7 +946,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
> unsigned long flags;
>
> if (write) {
> - for (i = 0;i < blocks * blksz;i++)
> + for (i = 0; i < blocks * blksz; i++)
> test->scratch[i] = i;
> } else {
> memset(test->scratch, 0, BUFFER_SIZE);
> @@ -980,7 +980,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
>
> memset(test->buffer, 0, sectors * 512);
>
> - for (i = 0;i < sectors;i++) {
> + for (i = 0; i < sectors; i++) {
> ret = mmc_test_buffer_transfer(test,
> test->buffer + i * 512,
> dev_addr + i, 512, 0);
> @@ -988,12 +988,12 @@ static int mmc_test_transfer(struct mmc_test_card *test,
> return ret;
> }
>
> - for (i = 0;i < blocks * blksz;i++) {
> + for (i = 0; i < blocks * blksz; i++) {
> if (test->buffer[i] != (u8)i)
> return RESULT_FAIL;
> }
>
> - for (;i < sectors * 512;i++) {
> + for (; i < sectors * 512; i++) {
> if (test->buffer[i] != 0xDF)
> return RESULT_FAIL;
> }
> @@ -1001,7 +1001,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
> local_irq_save(flags);
> sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
> local_irq_restore(flags);
> - for (i = 0;i < blocks * blksz;i++) {
> + for (i = 0; i < blocks * blksz; i++) {
> if (test->scratch[i] != (u8)i)
> return RESULT_FAIL;
> }
> @@ -1086,7 +1086,7 @@ static int mmc_test_multi_write(struct mmc_test_card *test)
>
> sg_init_one(&sg, test->buffer, size);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
> }
>
> static int mmc_test_multi_read(struct mmc_test_card *test)
> @@ -1107,7 +1107,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test)
>
> sg_init_one(&sg, test->buffer, size);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
> }
>
> static int mmc_test_pow2_write(struct mmc_test_card *test)
> @@ -1118,7 +1118,7 @@ static int mmc_test_pow2_write(struct mmc_test_card *test)
> if (!test->card->csd.write_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 1; i < 512;i <<= 1) {
> + for (i = 1; i < 512; i <<= 1) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
> if (ret)
> @@ -1136,7 +1136,7 @@ static int mmc_test_pow2_read(struct mmc_test_card *test)
> if (!test->card->csd.read_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 1; i < 512;i <<= 1) {
> + for (i = 1; i < 512; i <<= 1) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
> if (ret)
> @@ -1154,7 +1154,7 @@ static int mmc_test_weird_write(struct mmc_test_card *test)
> if (!test->card->csd.write_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 3; i < 512;i += 7) {
> + for (i = 3; i < 512; i += 7) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
> if (ret)
> @@ -1172,7 +1172,7 @@ static int mmc_test_weird_read(struct mmc_test_card *test)
> if (!test->card->csd.read_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 3; i < 512;i += 7) {
> + for (i = 3; i < 512; i += 7) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
> if (ret)
> @@ -1231,7 +1231,7 @@ static int mmc_test_align_multi_write(struct mmc_test_card *test)
>
> for (i = 1; i < TEST_ALIGN_END; i++) {
> sg_init_one(&sg, test->buffer + i, size);
> - ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> + ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
> if (ret)
> return ret;
> }
> @@ -1258,7 +1258,7 @@ static int mmc_test_align_multi_read(struct mmc_test_card *test)
>
> for (i = 1; i < TEST_ALIGN_END; i++) {
> sg_init_one(&sg, test->buffer + i, size);
> - ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> + ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
> if (ret)
> return ret;
> }
> @@ -1357,7 +1357,7 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test)
> sg_init_table(&sg, 1);
> sg_set_page(&sg, test->highmem, size, 0);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
> }
>
> static int mmc_test_multi_read_high(struct mmc_test_card *test)
> @@ -1379,7 +1379,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test)
> sg_init_table(&sg, 1);
> sg_set_page(&sg, test->highmem, size, 0);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
> }
>
> #else
> @@ -2147,7 +2147,7 @@ static int mmc_test_rw_multiple_sg_len(struct mmc_test_card *test,
> int i;
>
> for (i = 0 ; i < rw->len && ret == 0; i++) {
> - ret = mmc_test_rw_multiple(test, rw, 512*1024, rw->size,
> + ret = mmc_test_rw_multiple(test, rw, 512 * 1024, rw->size,
> rw->sg_len[i]);
> if (ret)
> break;
> @@ -2954,7 +2954,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
>
> mmc_claim_host(test->card->host);
>
> - for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) {
> + for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++) {
> struct mmc_test_general_result *gr;
>
> if (testcase && ((i + 1) != testcase))
> @@ -3165,7 +3165,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
>
> seq_puts(sf, "0:\tRun all tests\n");
> for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
> - seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
> + seq_printf(sf, "%d:\t%s\n", i + 1, mmc_test_cases[i].name);
>
> mutex_unlock(&mmc_test_lock);
>
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability
@ 2017-01-10 8:35 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:35 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:46, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 20:25:39 +0100
>
> Use space characters at some source code places according to
> the Linux coding style convention.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 42 +++++++++++++++++++++---------------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 848f4f30e343..42aefd3df09b 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -641,11 +641,11 @@ static int __mmc_test_prepare(struct mmc_test_card *test, int write)
> if (write)
> memset(test->buffer, 0xDF, 512);
> else {
> - for (i = 0;i < 512;i++)
> + for (i = 0; i < 512; i++)
> test->buffer[i] = i;
> }
>
> - for (i = 0;i < BUFFER_SIZE / 512;i++) {
> + for (i = 0; i < BUFFER_SIZE / 512; i++) {
> ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
> if (ret)
> return ret;
> @@ -674,7 +674,7 @@ static int mmc_test_cleanup(struct mmc_test_card *test)
>
> memset(test->buffer, 0, 512);
>
> - for (i = 0;i < BUFFER_SIZE / 512;i++) {
> + for (i = 0; i < BUFFER_SIZE / 512; i++) {
> ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1);
> if (ret)
> return ret;
> @@ -946,7 +946,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
> unsigned long flags;
>
> if (write) {
> - for (i = 0;i < blocks * blksz;i++)
> + for (i = 0; i < blocks * blksz; i++)
> test->scratch[i] = i;
> } else {
> memset(test->scratch, 0, BUFFER_SIZE);
> @@ -980,7 +980,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
>
> memset(test->buffer, 0, sectors * 512);
>
> - for (i = 0;i < sectors;i++) {
> + for (i = 0; i < sectors; i++) {
> ret = mmc_test_buffer_transfer(test,
> test->buffer + i * 512,
> dev_addr + i, 512, 0);
> @@ -988,12 +988,12 @@ static int mmc_test_transfer(struct mmc_test_card *test,
> return ret;
> }
>
> - for (i = 0;i < blocks * blksz;i++) {
> + for (i = 0; i < blocks * blksz; i++) {
> if (test->buffer[i] != (u8)i)
> return RESULT_FAIL;
> }
>
> - for (;i < sectors * 512;i++) {
> + for (; i < sectors * 512; i++) {
> if (test->buffer[i] != 0xDF)
> return RESULT_FAIL;
> }
> @@ -1001,7 +1001,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
> local_irq_save(flags);
> sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
> local_irq_restore(flags);
> - for (i = 0;i < blocks * blksz;i++) {
> + for (i = 0; i < blocks * blksz; i++) {
> if (test->scratch[i] != (u8)i)
> return RESULT_FAIL;
> }
> @@ -1086,7 +1086,7 @@ static int mmc_test_multi_write(struct mmc_test_card *test)
>
> sg_init_one(&sg, test->buffer, size);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
> }
>
> static int mmc_test_multi_read(struct mmc_test_card *test)
> @@ -1107,7 +1107,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test)
>
> sg_init_one(&sg, test->buffer, size);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
> }
>
> static int mmc_test_pow2_write(struct mmc_test_card *test)
> @@ -1118,7 +1118,7 @@ static int mmc_test_pow2_write(struct mmc_test_card *test)
> if (!test->card->csd.write_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 1; i < 512;i <<= 1) {
> + for (i = 1; i < 512; i <<= 1) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
> if (ret)
> @@ -1136,7 +1136,7 @@ static int mmc_test_pow2_read(struct mmc_test_card *test)
> if (!test->card->csd.read_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 1; i < 512;i <<= 1) {
> + for (i = 1; i < 512; i <<= 1) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
> if (ret)
> @@ -1154,7 +1154,7 @@ static int mmc_test_weird_write(struct mmc_test_card *test)
> if (!test->card->csd.write_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 3; i < 512;i += 7) {
> + for (i = 3; i < 512; i += 7) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 1);
> if (ret)
> @@ -1172,7 +1172,7 @@ static int mmc_test_weird_read(struct mmc_test_card *test)
> if (!test->card->csd.read_partial)
> return RESULT_UNSUP_CARD;
>
> - for (i = 3; i < 512;i += 7) {
> + for (i = 3; i < 512; i += 7) {
> sg_init_one(&sg, test->buffer, i);
> ret = mmc_test_transfer(test, &sg, 1, 0, 1, i, 0);
> if (ret)
> @@ -1231,7 +1231,7 @@ static int mmc_test_align_multi_write(struct mmc_test_card *test)
>
> for (i = 1; i < TEST_ALIGN_END; i++) {
> sg_init_one(&sg, test->buffer + i, size);
> - ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> + ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
> if (ret)
> return ret;
> }
> @@ -1258,7 +1258,7 @@ static int mmc_test_align_multi_read(struct mmc_test_card *test)
>
> for (i = 1; i < TEST_ALIGN_END; i++) {
> sg_init_one(&sg, test->buffer + i, size);
> - ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> + ret = mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
> if (ret)
> return ret;
> }
> @@ -1357,7 +1357,7 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test)
> sg_init_table(&sg, 1);
> sg_set_page(&sg, test->highmem, size, 0);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 1);
> }
>
> static int mmc_test_multi_read_high(struct mmc_test_card *test)
> @@ -1379,7 +1379,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test)
> sg_init_table(&sg, 1);
> sg_set_page(&sg, test->highmem, size, 0);
>
> - return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> + return mmc_test_transfer(test, &sg, 1, 0, size / 512, 512, 0);
> }
>
> #else
> @@ -2147,7 +2147,7 @@ static int mmc_test_rw_multiple_sg_len(struct mmc_test_card *test,
> int i;
>
> for (i = 0 ; i < rw->len && ret = 0; i++) {
> - ret = mmc_test_rw_multiple(test, rw, 512*1024, rw->size,
> + ret = mmc_test_rw_multiple(test, rw, 512 * 1024, rw->size,
> rw->sg_len[i]);
> if (ret)
> break;
> @@ -2954,7 +2954,7 @@ static void mmc_test_run(struct mmc_test_card *test, int testcase)
>
> mmc_claim_host(test->card->host);
>
> - for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) {
> + for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++) {
> struct mmc_test_general_result *gr;
>
> if (testcase && ((i + 1) != testcase))
> @@ -3165,7 +3165,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
>
> seq_puts(sf, "0:\tRun all tests\n");
> for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
> - seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
> + seq_printf(sf, "%d:\t%s\n", i + 1, mmc_test_cases[i].name);
>
> mutex_unlock(&mmc_test_lock);
>
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 3/8] mmc-core: Use seq_puts() in mtf_testlist_show()
2017-01-08 21:45 ` SF Markus Elfring
@ 2017-01-10 8:41 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:41 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:45, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:48:28 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer seq_puts to seq_printf
it saves some lock time,
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> Thus fix the affected source code place.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 2f838a13a904..848f4f30e343 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -3163,7 +3163,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
>
> mutex_lock(&mmc_test_lock);
>
> - seq_printf(sf, "0:\tRun all tests\n");
> + seq_puts(sf, "0:\tRun all tests\n");
> for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
> seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
>
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 3/8] mmc-core: Use seq_puts() in mtf_testlist_show()
@ 2017-01-10 8:41 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:41 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:45, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:48:28 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Prefer seq_puts to seq_printf
it saves some lock time,
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> Thus fix the affected source code place.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 2f838a13a904..848f4f30e343 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -3163,7 +3163,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data)
>
> mutex_lock(&mmc_test_lock);
>
> - seq_printf(sf, "0:\tRun all tests\n");
> + seq_puts(sf, "0:\tRun all tests\n");
> for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++)
> seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name);
>
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 2/8] mmc-core: Fix a typo in a comment line
2017-01-08 21:43 ` SF Markus Elfring
@ 2017-01-10 8:43 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:43 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors, trivial
On 2017/1/9 5:43, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:05:37 +0100
>
> Add a missing character in the function description.
>
Good catch!
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index e85ef503d7ce..2f838a13a904 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -1533,7 +1533,7 @@ static int mmc_test_area_cleanup(struct mmc_test_card *test)
>
> /*
> * Initialize an area for testing large transfers. The test area is set to the
> - * middle of the card because cards may have different charateristics at the
> + * middle of the card because cards may have different characteristics at the
> * front (for FAT file system optimization). Optionally, the area is erased
> * (if the card supports it) which may improve write performance. Optionally,
> * the area is filled with data for subsequent read tests.
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 2/8] mmc-core: Fix a typo in a comment line
@ 2017-01-10 8:43 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:43 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors, trivial
On 2017/1/9 5:43, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 19:05:37 +0100
>
> Add a missing character in the function description.
>
Good catch!
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index e85ef503d7ce..2f838a13a904 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -1533,7 +1533,7 @@ static int mmc_test_area_cleanup(struct mmc_test_card *test)
>
> /*
> * Initialize an area for testing large transfers. The test area is set to the
> - * middle of the card because cards may have different charateristics at the
> + * middle of the card because cards may have different characteristics at the
> * front (for FAT file system optimization). Optionally, the area is erased
> * (if the card supports it) which may improve write performance. Optionally,
> * the area is filled with data for subsequent read tests.
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
2017-01-08 21:42 ` SF Markus Elfring
@ 2017-01-10 8:44 ` Shawn Lin
-1 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:44 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:42, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 18:44:26 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> * Replace the specification of a data structure by a pointer dereference
> 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/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 3ab6e52d106c..e85ef503d7ce 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -1579,7 +1579,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
> if (!t->mem)
> return -ENOMEM;
>
> - t->sg = kmalloc(sizeof(struct scatterlist) * t->max_segs, GFP_KERNEL);
> + t->sg = kmalloc_array(t->max_segs, sizeof(*t->sg), GFP_KERNEL);
> if (!t->sg) {
> ret = -ENOMEM;
> goto out_free;
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
@ 2017-01-10 8:44 ` Shawn Lin
0 siblings, 0 replies; 56+ messages in thread
From: Shawn Lin @ 2017-01-10 8:44 UTC (permalink / raw)
To: SF Markus Elfring, linux-mmc, Adrian Hunter, Harjani Ritesh,
Jens Axboe, Linus Walleij, Mike Christie, Ulf Hansson,
Wolfram Sang
Cc: shawn.lin, LKML, kernel-janitors
On 2017/1/9 5:42, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 18:44:26 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> * Replace the specification of a data structure by a pointer dereference
> 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/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 3ab6e52d106c..e85ef503d7ce 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -1579,7 +1579,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
> if (!t->mem)
> return -ENOMEM;
>
> - t->sg = kmalloc(sizeof(struct scatterlist) * t->max_segs, GFP_KERNEL);
> + t->sg = kmalloc_array(t->max_segs, sizeof(*t->sg), GFP_KERNEL);
> if (!t->sg) {
> ret = -ENOMEM;
> goto out_free;
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
2017-01-08 21:42 ` SF Markus Elfring
@ 2017-01-11 1:59 ` Andy Shevchenko
-1 siblings, 0 replies; 56+ messages in thread
From: Andy Shevchenko @ 2017-01-11 1:59 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang, LKML, kernel-janitors
On Sun, Jan 8, 2017 at 11:42 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 18:44:26 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> to make the corresponding size determination a bit safer according to
> the Linux coding style convention.
For the whole series FWIW:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
P.S. Few years back I run those tests a lot, even did some
modifications, but now Nokia Mobile just gone :-)
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 3ab6e52d106c..e85ef503d7ce 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -1579,7 +1579,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
> if (!t->mem)
> return -ENOMEM;
>
> - t->sg = kmalloc(sizeof(struct scatterlist) * t->max_segs, GFP_KERNEL);
> + t->sg = kmalloc_array(t->max_segs, sizeof(*t->sg), GFP_KERNEL);
> if (!t->sg) {
> ret = -ENOMEM;
> goto out_free;
> --
> 2.11.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init()
@ 2017-01-11 1:59 ` Andy Shevchenko
0 siblings, 0 replies; 56+ messages in thread
From: Andy Shevchenko @ 2017-01-11 1:59 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Ulf Hansson,
Wolfram Sang, LKML, kernel-janitors
On Sun, Jan 8, 2017 at 11:42 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 18:44:26 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> to make the corresponding size determination a bit safer according to
> the Linux coding style convention.
For the whole series FWIW:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
P.S. Few years back I run those tests a lot, even did some
modifications, but now Nokia Mobile just gone :-)
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/mmc_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 3ab6e52d106c..e85ef503d7ce 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -1579,7 +1579,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
> if (!t->mem)
> return -ENOMEM;
>
> - t->sg = kmalloc(sizeof(struct scatterlist) * t->max_segs, GFP_KERNEL);
> + t->sg = kmalloc_array(t->max_segs, sizeof(*t->sg), GFP_KERNEL);
> if (!t->sg) {
> ret = -ENOMEM;
> goto out_free;
> --
> 2.11.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 0/8] MMC-core: Fine-tuning for some function implementations
2017-01-08 21:38 ` SF Markus Elfring
@ 2017-01-12 12:01 ` Ulf Hansson
-1 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2017-01-12 12:01 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Wolfram Sang, LKML,
kernel-janitors
On 8 January 2017 at 22:38, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 22:30:03 +0100
>
> Some update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (8):
> Use kmalloc_array() in mmc_test_area_init()
> Fix a typo in a comment line
> Use seq_puts() in mtf_testlist_show()
> mmc_test: Add some spaces for better code readability
> mmc_test: Combine substrings for 5 messages
> mmc_test: Improve a size determination in five functions
> Use kcalloc() in mmc_test_alloc_mem()
> Use kmalloc_array() in mmc_alloc_sg()
>
> drivers/mmc/core/mmc_test.c | 77 +++++++++++++++++++++------------------------
> drivers/mmc/core/queue.c | 2 +-
> 2 files changed, 36 insertions(+), 43 deletions(-)
>
Thanks applied for next, with some changes to the prefix of the commit
message headers.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 0/8] MMC-core: Fine-tuning for some function implementations
@ 2017-01-12 12:01 ` Ulf Hansson
0 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2017-01-12 12:01 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-mmc, Adrian Hunter, Harjani Ritesh, Jens Axboe,
Linus Walleij, Mike Christie, Shawn Lin, Wolfram Sang, LKML,
kernel-janitors
On 8 January 2017 at 22:38, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 22:30:03 +0100
>
> Some update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (8):
> Use kmalloc_array() in mmc_test_area_init()
> Fix a typo in a comment line
> Use seq_puts() in mtf_testlist_show()
> mmc_test: Add some spaces for better code readability
> mmc_test: Combine substrings for 5 messages
> mmc_test: Improve a size determination in five functions
> Use kcalloc() in mmc_test_alloc_mem()
> Use kmalloc_array() in mmc_alloc_sg()
>
> drivers/mmc/core/mmc_test.c | 77 +++++++++++++++++++++------------------------
> drivers/mmc/core/queue.c | 2 +-
> 2 files changed, 36 insertions(+), 43 deletions(-)
>
Thanks applied for next, with some changes to the prefix of the commit
message headers.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 56+ messages in thread
end of thread, other threads:[~2017-01-12 12:01 UTC | newest]
Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-08 21:38 [PATCH 0/8] MMC-core: Fine-tuning for some function implementations SF Markus Elfring
2017-01-08 21:38 ` SF Markus Elfring
2017-01-08 21:42 ` [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() SF Markus Elfring
2017-01-08 21:42 ` SF Markus Elfring
2017-01-09 18:31 ` Linus Walleij
2017-01-09 18:31 ` Linus Walleij
2017-01-10 7:37 ` Chunyan Zhang
2017-01-10 7:37 ` Chunyan Zhang
2017-01-10 8:44 ` Shawn Lin
2017-01-10 8:44 ` Shawn Lin
2017-01-11 1:59 ` Andy Shevchenko
2017-01-11 1:59 ` Andy Shevchenko
2017-01-08 21:43 ` [PATCH 2/8] mmc-core: Fix a typo in a comment line SF Markus Elfring
2017-01-08 21:43 ` SF Markus Elfring
2017-01-09 18:32 ` Linus Walleij
2017-01-09 18:32 ` Linus Walleij
2017-01-10 8:43 ` Shawn Lin
2017-01-10 8:43 ` Shawn Lin
2017-01-08 21:45 ` [PATCH 3/8] mmc-core: Use seq_puts() in mtf_testlist_show() SF Markus Elfring
2017-01-08 21:45 ` SF Markus Elfring
2017-01-09 18:33 ` Linus Walleij
2017-01-09 18:33 ` Linus Walleij
2017-01-10 8:41 ` Shawn Lin
2017-01-10 8:41 ` Shawn Lin
2017-01-08 21:46 ` [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability SF Markus Elfring
2017-01-08 21:46 ` SF Markus Elfring
2017-01-09 18:34 ` Linus Walleij
2017-01-09 18:34 ` Linus Walleij
2017-01-10 8:35 ` Shawn Lin
2017-01-10 8:35 ` Shawn Lin
2017-01-08 21:47 ` [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages SF Markus Elfring
2017-01-08 21:47 ` SF Markus Elfring
2017-01-09 18:35 ` Linus Walleij
2017-01-09 18:35 ` Linus Walleij
2017-01-10 8:34 ` Shawn Lin
2017-01-10 8:34 ` Shawn Lin
2017-01-08 21:49 ` [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions SF Markus Elfring
2017-01-08 21:49 ` SF Markus Elfring
2017-01-09 18:35 ` Linus Walleij
2017-01-09 18:35 ` Linus Walleij
2017-01-10 8:31 ` Shawn Lin
2017-01-10 8:31 ` Shawn Lin
2017-01-08 21:50 ` [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem() SF Markus Elfring
2017-01-08 21:50 ` SF Markus Elfring
2017-01-09 18:36 ` Linus Walleij
2017-01-09 18:36 ` Linus Walleij
2017-01-10 8:28 ` Shawn Lin
2017-01-10 8:28 ` Shawn Lin
2017-01-08 21:55 ` [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() SF Markus Elfring
2017-01-08 21:55 ` SF Markus Elfring
2017-01-09 18:37 ` Linus Walleij
2017-01-09 18:37 ` Linus Walleij
2017-01-10 8:27 ` Shawn Lin
2017-01-10 8:27 ` Shawn Lin
2017-01-12 12:01 ` [PATCH 0/8] MMC-core: Fine-tuning for some function implementations Ulf Hansson
2017-01-12 12:01 ` Ulf Hansson
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.