* [PATCH 0/3] char-bsr: Adjustments for two function implementations
@ 2017-10-15 20:07 SF Markus Elfring
2017-10-15 20:08 ` [PATCH 1/3] char/bsr: Delete an error message for a failed memory allocation in bsr_add_node() SF Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-10-15 20:07 UTC (permalink / raw)
To: kernel-janitors, Arnd Bergmann, Greg Kroah-Hartman; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Oct 2017 22:02:34 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation in bsr_add_node()
Improve a size determination in bsr_add_node()
Adjust one function call together with a variable assignment
drivers/char/bsr.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--
2.14.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] char/bsr: Delete an error message for a failed memory allocation in bsr_add_node()
2017-10-15 20:07 [PATCH 0/3] char-bsr: Adjustments for two function implementations SF Markus Elfring
@ 2017-10-15 20:08 ` SF Markus Elfring
2017-10-15 20:09 ` [PATCH 2/3] char/bsr: Improve a size determination " SF Markus Elfring
2017-10-15 20:10 ` [PATCH 3/3] char/bsr: Adjust one function call together with a variable assignment SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-10-15 20:08 UTC (permalink / raw)
To: kernel-janitors, Arnd Bergmann, Greg Kroah-Hartman; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Oct 2017 21:12:34 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/char/bsr.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index a6cef548e01e..865eb457e539 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -203,7 +203,6 @@ static int bsr_add_node(struct device_node *bn)
int result;
if (!cur) {
- printk(KERN_ERR "Unable to alloc bsr dev\n");
ret = -ENOMEM;
goto out_err;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] char/bsr: Improve a size determination in bsr_add_node()
2017-10-15 20:07 [PATCH 0/3] char-bsr: Adjustments for two function implementations SF Markus Elfring
2017-10-15 20:08 ` [PATCH 1/3] char/bsr: Delete an error message for a failed memory allocation in bsr_add_node() SF Markus Elfring
@ 2017-10-15 20:09 ` SF Markus Elfring
2017-10-15 20:10 ` [PATCH 3/3] char/bsr: Adjust one function call together with a variable assignment SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-10-15 20:09 UTC (permalink / raw)
To: kernel-janitors, Arnd Bergmann, Greg Kroah-Hartman; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Oct 2017 21:25:46 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/char/bsr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 865eb457e539..d0597dfa4d88 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -197,8 +197,7 @@ static int bsr_add_node(struct device_node *bn)
num_bsr_devs = bsr_bytes_len / sizeof(u32);
for (i = 0 ; i < num_bsr_devs; i++) {
- struct bsr_dev *cur = kzalloc(sizeof(struct bsr_dev),
- GFP_KERNEL);
+ struct bsr_dev *cur = kzalloc(sizeof(*cur), GFP_KERNEL);
struct resource res;
int result;
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] char/bsr: Adjust one function call together with a variable assignment
2017-10-15 20:07 [PATCH 0/3] char-bsr: Adjustments for two function implementations SF Markus Elfring
2017-10-15 20:08 ` [PATCH 1/3] char/bsr: Delete an error message for a failed memory allocation in bsr_add_node() SF Markus Elfring
2017-10-15 20:09 ` [PATCH 2/3] char/bsr: Improve a size determination " SF Markus Elfring
@ 2017-10-15 20:10 ` SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-10-15 20:10 UTC (permalink / raw)
To: kernel-janitors, Arnd Bergmann, Greg Kroah-Hartman; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Oct 2017 21:55:26 +0200
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code place.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/char/bsr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index d0597dfa4d88..f11df210294a 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -320,7 +320,8 @@ static int __init bsr_init(void)
goto out_err_2;
}
- if ((ret = bsr_create_devs(np)) < 0) {
+ ret = bsr_create_devs(np);
+ if (ret < 0) {
np = NULL;
goto out_err_3;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-15 20:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-15 20:07 [PATCH 0/3] char-bsr: Adjustments for two function implementations SF Markus Elfring
2017-10-15 20:08 ` [PATCH 1/3] char/bsr: Delete an error message for a failed memory allocation in bsr_add_node() SF Markus Elfring
2017-10-15 20:09 ` [PATCH 2/3] char/bsr: Improve a size determination " SF Markus Elfring
2017-10-15 20:10 ` [PATCH 3/3] char/bsr: Adjust one function call together with a variable assignment SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).