* [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi()
@ 2017-06-04 21:04 SF Markus Elfring
2017-06-04 21:05 ` [PATCH 1/3] arm/xen: Improve a size determination in __set_phys_to_machine_multi() SF Markus Elfring
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-06-04 21:04 UTC (permalink / raw)
To: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 4 Jun 2017 22:45:54 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Improve a size determination
Delete an error message for a failed memory allocation
Adjust one function call together with a variable assignment
arch/arm/xen/p2m.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--
2.13.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] arm/xen: Improve a size determination in __set_phys_to_machine_multi()
2017-06-04 21:04 [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() SF Markus Elfring
@ 2017-06-04 21:05 ` SF Markus Elfring
2017-06-05 17:16 ` Stefano Stabellini
2017-06-04 21:06 ` [PATCH 2/3] arm/xen: Delete an error message for a failed memory allocation " SF Markus Elfring
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2017-06-04 21:05 UTC (permalink / raw)
To: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 4 Jun 2017 20:50:55 +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>
---
arch/arm/xen/p2m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index 0ed01f2d5ee4..11e78432b663 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -144,5 +144,5 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
return true;
}
- p2m_entry = kzalloc(sizeof(struct xen_p2m_entry), GFP_NOWAIT);
+ p2m_entry = kzalloc(sizeof(*p2m_entry), GFP_NOWAIT);
if (!p2m_entry) {
--
2.13.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] arm/xen: Delete an error message for a failed memory allocation in __set_phys_to_machine_multi()
2017-06-04 21:04 [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() SF Markus Elfring
2017-06-04 21:05 ` [PATCH 1/3] arm/xen: Improve a size determination in __set_phys_to_machine_multi() SF Markus Elfring
@ 2017-06-04 21:06 ` SF Markus Elfring
2017-06-05 17:17 ` Stefano Stabellini
2017-06-04 21:07 ` [PATCH 3/3] arm/xen: Adjust one function call together with a variable assignment SF Markus Elfring
2017-06-05 17:51 ` [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() Stefano Stabellini
3 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2017-06-04 21:06 UTC (permalink / raw)
To: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 4 Jun 2017 21:12:36 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/arm/xen/p2m.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index 11e78432b663..f5f74ac637b9 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -148,7 +148,6 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
- if (!p2m_entry) {
- pr_warn("cannot allocate xen_p2m_entry\n");
+ if (!p2m_entry)
return false;
- }
+
p2m_entry->pfn = pfn;
p2m_entry->nr_pages = nr_pages;
p2m_entry->mfn = mfn;
--
2.13.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] arm/xen: Adjust one function call together with a variable assignment
2017-06-04 21:04 [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() SF Markus Elfring
2017-06-04 21:05 ` [PATCH 1/3] arm/xen: Improve a size determination in __set_phys_to_machine_multi() SF Markus Elfring
2017-06-04 21:06 ` [PATCH 2/3] arm/xen: Delete an error message for a failed memory allocation " SF Markus Elfring
@ 2017-06-04 21:07 ` SF Markus Elfring
2017-06-05 17:18 ` Stefano Stabellini
2017-06-05 17:51 ` [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() Stefano Stabellini
3 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2017-06-04 21:07 UTC (permalink / raw)
To: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 4 Jun 2017 21:21:20 +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>
---
arch/arm/xen/p2m.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index f5f74ac637b9..e71eefa2e427 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -153,7 +153,8 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
p2m_entry->mfn = mfn;
write_lock_irqsave(&p2m_lock, irqflags);
- if ((rc = xen_add_phys_to_mach_entry(p2m_entry)) < 0) {
+ rc = xen_add_phys_to_mach_entry(p2m_entry);
+ if (rc < 0) {
write_unlock_irqrestore(&p2m_lock, irqflags);
return false;
}
--
2.13.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] arm/xen: Improve a size determination in __set_phys_to_machine_multi()
2017-06-04 21:05 ` [PATCH 1/3] arm/xen: Improve a size determination in __set_phys_to_machine_multi() SF Markus Elfring
@ 2017-06-05 17:16 ` Stefano Stabellini
0 siblings, 0 replies; 8+ messages in thread
From: Stefano Stabellini @ 2017-06-05 17:16 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini,
LKML, kernel-janitors
On Sun, 4 Jun 2017, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Jun 2017 20:50:55 +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>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
> arch/arm/xen/p2m.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
> index 0ed01f2d5ee4..11e78432b663 100644
> --- a/arch/arm/xen/p2m.c
> +++ b/arch/arm/xen/p2m.c
> @@ -144,5 +144,5 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
> return true;
> }
>
> - p2m_entry = kzalloc(sizeof(struct xen_p2m_entry), GFP_NOWAIT);
> + p2m_entry = kzalloc(sizeof(*p2m_entry), GFP_NOWAIT);
> if (!p2m_entry) {
> --
> 2.13.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] arm/xen: Delete an error message for a failed memory allocation in __set_phys_to_machine_multi()
2017-06-04 21:06 ` [PATCH 2/3] arm/xen: Delete an error message for a failed memory allocation " SF Markus Elfring
@ 2017-06-05 17:17 ` Stefano Stabellini
0 siblings, 0 replies; 8+ messages in thread
From: Stefano Stabellini @ 2017-06-05 17:17 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini,
kernel-janitors, LKML
On Sun, 4 Jun 2017, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Jun 2017 21:12:36 +0200
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
> arch/arm/xen/p2m.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
> index 11e78432b663..f5f74ac637b9 100644
> --- a/arch/arm/xen/p2m.c
> +++ b/arch/arm/xen/p2m.c
> @@ -148,7 +148,6 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
> - if (!p2m_entry) {
> - pr_warn("cannot allocate xen_p2m_entry\n");
> + if (!p2m_entry)
> return false;
> - }
> +
> p2m_entry->pfn = pfn;
> p2m_entry->nr_pages = nr_pages;
> p2m_entry->mfn = mfn;
> --
> 2.13.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] arm/xen: Adjust one function call together with a variable assignment
2017-06-04 21:07 ` [PATCH 3/3] arm/xen: Adjust one function call together with a variable assignment SF Markus Elfring
@ 2017-06-05 17:18 ` Stefano Stabellini
0 siblings, 0 replies; 8+ messages in thread
From: Stefano Stabellini @ 2017-06-05 17:18 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini,
LKML, kernel-janitors
On Sun, 4 Jun 2017, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Jun 2017 21:21:20 +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>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
> arch/arm/xen/p2m.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
> index f5f74ac637b9..e71eefa2e427 100644
> --- a/arch/arm/xen/p2m.c
> +++ b/arch/arm/xen/p2m.c
> @@ -153,7 +153,8 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
> p2m_entry->mfn = mfn;
>
> write_lock_irqsave(&p2m_lock, irqflags);
> - if ((rc = xen_add_phys_to_mach_entry(p2m_entry)) < 0) {
> + rc = xen_add_phys_to_mach_entry(p2m_entry);
> + if (rc < 0) {
> write_unlock_irqrestore(&p2m_lock, irqflags);
> return false;
> }
> --
> 2.13.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi()
2017-06-04 21:04 [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() SF Markus Elfring
` (2 preceding siblings ...)
2017-06-04 21:07 ` [PATCH 3/3] arm/xen: Adjust one function call together with a variable assignment SF Markus Elfring
@ 2017-06-05 17:51 ` Stefano Stabellini
3 siblings, 0 replies; 8+ messages in thread
From: Stefano Stabellini @ 2017-06-05 17:51 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-arm-kernel, xen-devel, Russell King, Stefano Stabellini,
kernel-janitors, LKML
On Sun, 4 Jun 2017, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 4 Jun 2017 22:45:54 +0200
>
> Three update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (3):
> Improve a size determination
> Delete an error message for a failed memory allocation
> Adjust one function call together with a variable assignment
>
> arch/arm/xen/p2m.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Thanks Markus, I queued them up for 4.13.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-06-05 17:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-04 21:04 [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() SF Markus Elfring
2017-06-04 21:05 ` [PATCH 1/3] arm/xen: Improve a size determination in __set_phys_to_machine_multi() SF Markus Elfring
2017-06-05 17:16 ` Stefano Stabellini
2017-06-04 21:06 ` [PATCH 2/3] arm/xen: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-06-05 17:17 ` Stefano Stabellini
2017-06-04 21:07 ` [PATCH 3/3] arm/xen: Adjust one function call together with a variable assignment SF Markus Elfring
2017-06-05 17:18 ` Stefano Stabellini
2017-06-05 17:51 ` [PATCH 0/3] ARM-XEN: Adjustments for __set_phys_to_machine_multi() Stefano Stabellini
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).