Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()
On Fri, Mar 16, 2018 at 09:26:53PM +1100, Michael Ellerman wrote: > Dan Carpenterwrites: > > On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: > >> SF Markus Elfring writes: > >> > From: Markus Elfring > >> > Date: Sun, 11 Mar 2018 09:03:42 +0100 > >> > > >> > Add a jump target so that a bit of exception handling can be better > >> > reused > >> > at the end of this function. > >> > > >> > This issue was detected by using the Coccinelle software. > >> > > >> > Signed-off-by: Markus Elfring > >> > --- > >> > arch/powerpc/kernel/machine_kexec_file_64.c | 28 > >> > > >> > 1 file changed, 12 insertions(+), 16 deletions(-) > >> > >> I liked it. Thanks! > >> > >> Reviewed-by: Thiago Jung Bauermann > > > > You know that compilers already re-use string constants so this doesn't > > actually save memory? > > Sure, but it's still clearer to only have the string appear once in the > code. > To me the original was better. > > Also we should be preserving the error codes > > instead of always returning -EINVAL. > > The error codes come from libfdt code, so they don't necessarily make > sense in the kernel. eg. FDT_ERR_NOSPACE == 3 == ESRCH. > > Perhaps we should be trying harder to convert them, but that's a > criticism of the original code not this patch. Ah. You're right. I look at the patch in context, sorry. regards, dan carpenter
Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()
Joe Percheswrites: > On Thu, 2018-03-15 at 14:57 +0300, Dan Carpenter wrote: >> On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: >> > SF Markus Elfring writes: >> > > From: Markus Elfring >> > > Date: Sun, 11 Mar 2018 09:03:42 +0100 >> > > >> > > Add a jump target so that a bit of exception handling can be better >> > > reused >> > > at the end of this function. >> > > >> > > This issue was detected by using the Coccinelle software. >> > > >> > > Signed-off-by: Markus Elfring >> > > --- >> > > arch/powerpc/kernel/machine_kexec_file_64.c | 28 >> > > >> > > 1 file changed, 12 insertions(+), 16 deletions(-) >> > >> > I liked it. Thanks! >> > >> > Reviewed-by: Thiago Jung Bauermann >> >> You know that compilers already re-use string constants so this doesn't >> actually save memory? > > And modern compilers create their own jump labels > so this doesn't change object code either? I must have missed the memo about us only changing source code if it results in better object code. cheers
Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()
Dan Carpenterwrites: > On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: >> SF Markus Elfring writes: >> > From: Markus Elfring >> > Date: Sun, 11 Mar 2018 09:03:42 +0100 >> > >> > Add a jump target so that a bit of exception handling can be better reused >> > at the end of this function. >> > >> > This issue was detected by using the Coccinelle software. >> > >> > Signed-off-by: Markus Elfring >> > --- >> > arch/powerpc/kernel/machine_kexec_file_64.c | 28 >> > >> > 1 file changed, 12 insertions(+), 16 deletions(-) >> >> I liked it. Thanks! >> >> Reviewed-by: Thiago Jung Bauermann > > You know that compilers already re-use string constants so this doesn't > actually save memory? Sure, but it's still clearer to only have the string appear once in the code. > Also we should be preserving the error codes > instead of always returning -EINVAL. The error codes come from libfdt code, so they don't necessarily make sense in the kernel. eg. FDT_ERR_NOSPACE == 3 == ESRCH. Perhaps we should be trying harder to convert them, but that's a criticism of the original code not this patch. cheers
Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()
Joe Percheswrites: > On Thu, 2018-03-15 at 14:57 +0300, Dan Carpenter wrote: >> On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: >> > >> > SF Markus Elfring writes: >> > >> > > From: Markus Elfring >> > > Date: Sun, 11 Mar 2018 09:03:42 +0100 >> > > >> > > Add a jump target so that a bit of exception handling can be better >> > > reused >> > > at the end of this function. >> > > >> > > This issue was detected by using the Coccinelle software. >> > > >> > > Signed-off-by: Markus Elfring >> > > --- >> > > arch/powerpc/kernel/machine_kexec_file_64.c | 28 >> > > >> > > 1 file changed, 12 insertions(+), 16 deletions(-) >> > >> > I liked it. Thanks! >> > >> > Reviewed-by: Thiago Jung Bauermann >> > >> >> You know that compilers already re-use string constants so this doesn't >> actually save memory? > > And modern compilers create their own jump labels > so this doesn't change object code either? IMHO it's an improvement to the source code itself. I wasn't thinking about the object file. -- Thiago Jung Bauermann IBM Linux Technology Center
Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()
On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: > > SF Markus Elfringwrites: > > > From: Markus Elfring > > Date: Sun, 11 Mar 2018 09:03:42 +0100 > > > > Add a jump target so that a bit of exception handling can be better reused > > at the end of this function. > > > > This issue was detected by using the Coccinelle software. > > > > Signed-off-by: Markus Elfring > > --- > > arch/powerpc/kernel/machine_kexec_file_64.c | 28 > > > > 1 file changed, 12 insertions(+), 16 deletions(-) > > I liked it. Thanks! > > Reviewed-by: Thiago Jung Bauermann > You know that compilers already re-use string constants so this doesn't actually save memory? Also we should be preserving the error codes instead of always returning -EINVAL. regards, dan carpenter
Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()
On Thu, 2018-03-15 at 14:57 +0300, Dan Carpenter wrote: > On Wed, Mar 14, 2018 at 06:22:07PM -0300, Thiago Jung Bauermann wrote: > > > > SF Markus Elfringwrites: > > > > > From: Markus Elfring > > > Date: Sun, 11 Mar 2018 09:03:42 +0100 > > > > > > Add a jump target so that a bit of exception handling can be better reused > > > at the end of this function. > > > > > > This issue was detected by using the Coccinelle software. > > > > > > Signed-off-by: Markus Elfring > > > --- > > > arch/powerpc/kernel/machine_kexec_file_64.c | 28 > > > > > > 1 file changed, 12 insertions(+), 16 deletions(-) > > > > I liked it. Thanks! > > > > Reviewed-by: Thiago Jung Bauermann > > > > You know that compilers already re-use string constants so this doesn't > actually save memory? And modern compilers create their own jump labels so this doesn't change object code either?
Re: [PATCH] powerpc: Use common error handling code in setup_new_fdt()
SF Markus Elfringwrites: > From: Markus Elfring > Date: Sun, 11 Mar 2018 09:03:42 +0100 > > Add a jump target so that a bit of exception handling can be better reused > at the end of this function. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > arch/powerpc/kernel/machine_kexec_file_64.c | 28 > 1 file changed, 12 insertions(+), 16 deletions(-) I liked it. Thanks! Reviewed-by: Thiago Jung Bauermann -- Thiago Jung Bauermann IBM Linux Technology Center