* Fix some gcc5 warnings @ 2015-12-10 10:07 Sascha Hauer 2015-12-10 10:07 ` [PATCH 1/3] ubiformat: fix the subpage size hint on the error path Sascha Hauer ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Sascha Hauer @ 2015-12-10 10:07 UTC (permalink / raw) To: Barebox List new compiler, new warnings. Fix a few of them. ---------------------------------------------------------------- Sascha Hauer (3): ubiformat: fix the subpage size hint on the error path linux/barebox-wrapper: Silence gcc5 warning ARM: Omap3: Remove useless inline arch/arm/mach-omap/include/mach/sys_info.h | 2 +- arch/arm/mach-omap/omap3_generic.c | 2 +- commands/ubiformat.c | 5 ++--- include/linux/barebox-wrapper.h | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] ubiformat: fix the subpage size hint on the error path 2015-12-10 10:07 Fix some gcc5 warnings Sascha Hauer @ 2015-12-10 10:07 ` Sascha Hauer 2015-12-10 10:07 ` [PATCH 2/3] linux/barebox-wrapper: Silence gcc5 warning Sascha Hauer 2015-12-10 10:07 ` [PATCH 3/3] ARM: Omap3: Remove useless inline Sascha Hauer 2 siblings, 0 replies; 6+ messages in thread From: Sascha Hauer @ 2015-12-10 10:07 UTC (permalink / raw) To: Barebox List From mtd-utils commit: | commit 15685fe39f1665d53d8b316c8f837f20f8700d4b | Author: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | Date: Mon Sep 8 15:05:54 2014 +0300 | | ubiformat: fix the subpage size hint on the error path | | David Binderman <dcb314@hotmail.com> reports that the following piece of looks | wrong: | | if (!args.subpage_size != mtd->min_io_size) | normsg("may be sub-page size is incorrect?"); | | I totally agree with him and I believe that we actually meant to have no | negation in fron to f 'args.subpage_size', so instead, the code should look | like this: | | if (args.subpage_size != mtd->min_io_size) | normsg("may be sub-page size is incorrect?"); | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- commands/ubiformat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/commands/ubiformat.c b/commands/ubiformat.c index 8516e11..f9c50b7 100644 --- a/commands/ubiformat.c +++ b/commands/ubiformat.c @@ -503,9 +503,8 @@ static int format(const struct mtd_dev_info *mtd, write_size, eb); if (errno != EIO) { - if (!args.subpage_size != mtd->min_io_size) - normsg("may be sub-page size is " - "incorrect?"); + if (args.subpage_size != mtd->min_io_size) + normsg("may be sub-page size is incorrect?"); goto out_free; } -- 2.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] linux/barebox-wrapper: Silence gcc5 warning 2015-12-10 10:07 Fix some gcc5 warnings Sascha Hauer 2015-12-10 10:07 ` [PATCH 1/3] ubiformat: fix the subpage size hint on the error path Sascha Hauer @ 2015-12-10 10:07 ` Sascha Hauer 2015-12-10 19:23 ` Trent Piepho 2015-12-10 10:07 ` [PATCH 3/3] ARM: Omap3: Remove useless inline Sascha Hauer 2 siblings, 1 reply; 6+ messages in thread From: Sascha Hauer @ 2015-12-10 10:07 UTC (permalink / raw) To: Barebox List gcc5 warns about using flags uninitialized in spin_lock_irqsave, although it could look into the static inline spin_lock_irqsave implementation and see it's not used at all. An empty define instead of the static inline wrapper would lead to a "unused variable" warning. Let's create a macro and fake some usage of the flags variable. This probably helps until gcc6 is out. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- include/linux/barebox-wrapper.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h index 3859185..5fe7971 100644 --- a/include/linux/barebox-wrapper.h +++ b/include/linux/barebox-wrapper.h @@ -39,8 +39,8 @@ typedef int spinlock_t; #define spin_lock_init(...) #define spin_lock(...) #define spin_unlock(...) -static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long flags) {} -static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) {} +#define spin_lock_irqsave(lock, flags) do { flags = 0; } while (0) +#define spin_unlock_irqrestore(lock, flags) do { flags = flags; } while (0) #define mutex_init(...) #define mutex_lock(...) -- 2.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] linux/barebox-wrapper: Silence gcc5 warning 2015-12-10 10:07 ` [PATCH 2/3] linux/barebox-wrapper: Silence gcc5 warning Sascha Hauer @ 2015-12-10 19:23 ` Trent Piepho 2015-12-11 7:12 ` Sascha Hauer 0 siblings, 1 reply; 6+ messages in thread From: Trent Piepho @ 2015-12-10 19:23 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List On Thu, 2015-12-10 at 11:07 +0100, Sascha Hauer wrote: > gcc5 warns about using flags uninitialized in spin_lock_irqsave, > although it could look into the static inline spin_lock_irqsave > implementation and see it's not used at all. An empty define instead > of the static inline wrapper would lead to a "unused variable" warning. > Let's create a macro and fake some usage of the flags variable. This > probably helps until gcc6 is out. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > include/linux/barebox-wrapper.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h > index 3859185..5fe7971 100644 > --- a/include/linux/barebox-wrapper.h > +++ b/include/linux/barebox-wrapper.h > @@ -39,8 +39,8 @@ typedef int spinlock_t; > #define spin_lock_init(...) > #define spin_lock(...) > #define spin_unlock(...) > -static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long flags) {} > -static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) {} > +#define spin_lock_irqsave(lock, flags) do { flags = 0; } while (0) > +#define spin_unlock_irqrestore(lock, flags) do { flags = flags; } while (0) It's more complex, but one would still get compiler type checking of the arguments if one did: static inline void _slis(spinlock_t *lock, unsigned long flags) {} static inline void _slir(spinlock_t *lock, unsigned long flags) {} #define spin_lock_irqsave(lock, flags) _slis(lock, flags = 0) #define spin_lock_irqrestore(lock, flags) _slir(lock, flags = flags) It think that would make gcc happy too? _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] linux/barebox-wrapper: Silence gcc5 warning 2015-12-10 19:23 ` Trent Piepho @ 2015-12-11 7:12 ` Sascha Hauer 0 siblings, 0 replies; 6+ messages in thread From: Sascha Hauer @ 2015-12-11 7:12 UTC (permalink / raw) To: Trent Piepho; +Cc: Barebox List On Thu, Dec 10, 2015 at 07:23:33PM +0000, Trent Piepho wrote: > On Thu, 2015-12-10 at 11:07 +0100, Sascha Hauer wrote: > > gcc5 warns about using flags uninitialized in spin_lock_irqsave, > > although it could look into the static inline spin_lock_irqsave > > implementation and see it's not used at all. An empty define instead > > of the static inline wrapper would lead to a "unused variable" warning. > > Let's create a macro and fake some usage of the flags variable. This > > probably helps until gcc6 is out. > > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > > --- > > include/linux/barebox-wrapper.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h > > index 3859185..5fe7971 100644 > > --- a/include/linux/barebox-wrapper.h > > +++ b/include/linux/barebox-wrapper.h > > @@ -39,8 +39,8 @@ typedef int spinlock_t; > > #define spin_lock_init(...) > > #define spin_lock(...) > > #define spin_unlock(...) > > -static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long flags) {} > > -static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) {} > > +#define spin_lock_irqsave(lock, flags) do { flags = 0; } while (0) > > +#define spin_unlock_irqrestore(lock, flags) do { flags = flags; } while (0) > > It's more complex, but one would still get compiler type checking of the > arguments if one did: > > static inline void _slis(spinlock_t *lock, unsigned long flags) {} > static inline void _slir(spinlock_t *lock, unsigned long flags) {} > #define spin_lock_irqsave(lock, flags) _slis(lock, flags = 0) > #define spin_lock_irqrestore(lock, flags) _slir(lock, flags = flags) > > It think that would make gcc happy too? Yes, I that should work aswell. I don't think we need the type safety check though. The spin_lock functions purely exist to help adopting kernel code, so if the flags variable had the wrong type it wouldn't have worked in the kernel. Even if the type is wrong it doesn't affect the barebox code. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] ARM: Omap3: Remove useless inline 2015-12-10 10:07 Fix some gcc5 warnings Sascha Hauer 2015-12-10 10:07 ` [PATCH 1/3] ubiformat: fix the subpage size hint on the error path Sascha Hauer 2015-12-10 10:07 ` [PATCH 2/3] linux/barebox-wrapper: Silence gcc5 warning Sascha Hauer @ 2015-12-10 10:07 ` Sascha Hauer 2 siblings, 0 replies; 6+ messages in thread From: Sascha Hauer @ 2015-12-10 10:07 UTC (permalink / raw) To: Barebox List Silences gcc5 warning: In file included from arch/arm/mach-omap/gpmc.c:31:0: arch/arm/mach-omap/include/mach/sys_info.h:93:83: warning: inline function 'get_sysboot_value' declared but never defined Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/mach-omap/include/mach/sys_info.h | 2 +- arch/arm/mach-omap/omap3_generic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap/include/mach/sys_info.h b/arch/arm/mach-omap/include/mach/sys_info.h index fbac9b5..e36f49d 100644 --- a/arch/arm/mach-omap/include/mach/sys_info.h +++ b/arch/arm/mach-omap/include/mach/sys_info.h @@ -90,7 +90,7 @@ u32 get_cpu_type(void); u32 get_cpu_rev(void); u32 get_sdr_cs_size(u32 offset); u32 get_sdr_cs1_base(void); -inline u32 get_sysboot_value(void); +u32 get_sysboot_value(void); u32 get_boot_type(void); u32 get_device_type(void); diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c index 5c29fea..5327bad 100644 --- a/arch/arm/mach-omap/omap3_generic.c +++ b/arch/arm/mach-omap/omap3_generic.c @@ -200,7 +200,7 @@ EXPORT_SYMBOL(get_sdr_cs1_base); * * @return - Return the value of SYSBOOT. */ -inline u32 get_sysboot_value(void) +u32 get_sysboot_value(void) { return (0x0000003F & readl(OMAP3_CONTROL_REG(STATUS))); } -- 2.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-12-11 7:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-12-10 10:07 Fix some gcc5 warnings Sascha Hauer 2015-12-10 10:07 ` [PATCH 1/3] ubiformat: fix the subpage size hint on the error path Sascha Hauer 2015-12-10 10:07 ` [PATCH 2/3] linux/barebox-wrapper: Silence gcc5 warning Sascha Hauer 2015-12-10 19:23 ` Trent Piepho 2015-12-11 7:12 ` Sascha Hauer 2015-12-10 10:07 ` [PATCH 3/3] ARM: Omap3: Remove useless inline Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox