Skip to contentSkip to conversation

OMAP compile warning fix

PATCH New Felipe Balbi 3 participants 12 messages Jan 17, 2011 – Jan 20, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover OMAP compile warning fix

Hi Tony,

I gave it a shot at dropping a few compile warnings from omap1-only and omap2-only builds.

Following are 7 patches which I came up with. All compile tested with omap1_defconfig and omap2_defconfig (the latter being a result of omap2plus_defconfig - omap3 and omap4 support and adding any other config option which was disabled)

There are a few more warnings to clean up, though. I didn't tackle all of them.

Felipe Balbi (7):
arm: omap: i2c: fix compile warning
arm: omap1: fix compile warning
arm: omap1: fix compile warnings
arm: omap1: fix a bunch of section mismatches
arm: omap2: mux: fix compile warning
arm: omap2: irq: fix compile warning:
arm: omap2: clksel: fix compile warning

 arch/arm/mach-omap1/board-ams-delta.c  |   14 +++---
 arch/arm/mach-omap1/board-fsample.c    |    2 +-
 arch/arm/mach-omap1/board-palmte.c     |   13 -----
 arch/arm/mach-omap2/clkt_clksel.c      |    5 ++-
 arch/arm/mach-omap2/irq.c              |    4 +-
 arch/arm/mach-omap2/mux.c              |    2 +-
 arch/arm/plat-omap/i2c.c               |    2 +-
 arch/arm/plat-omap/include/plat/fpga.h |   92 ++++++++++++++++----------------
 8 files changed, 62 insertions(+), 72 deletions(-)
Signature · 1 line
1.7.3.4.598.g85356
#1 lore raw

PATCH 1/7 arm: omap: i2c: fix compile warning

Fix the following compile warning:
arch/arm/plat-omap/i2c.c:120:13: warning:
'omap_pm_set_max_mpu_wakeup_lat_compat' defined but not used arch/arm/plat-omap/i2c.c:125:38: warning: 'omap_i2c_latency' defined but not used

---
 arch/arm/plat-omap/i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/i2c.c +1 -1
index a4f8003..3341ca4 100644
@@ -112,6 +112,7 @@ static inline int omap1_i2c_add_bus(int bus_id)
 }
 
 
+#ifdef CONFIG_ARCH_OMAP2PLUS
 /*
  * XXX This function is a temporary compatibility wrapper - only
  * needed until the I2C driver can be converted to call
@@ -130,7 +131,6 @@ static struct omap_device_pm_latency omap_i2c_latency[] = {
 	},
 };
 
-#ifdef CONFIG_ARCH_OMAP2PLUS
 static inline int omap2_i2c_add_bus(int bus_id)
 {
 	int l;
Signature · 1 line
1.7.3.4.598.g85356
#2 lore raw

PATCH 2/7 arm: omap1: fix compile warning

In reply to Felipe Balbi

Fix the following compile warning:
arch/arm/mach-omap1/board-palmte.c:233:13: warning:
'palmte_headphones_detect' defined but not used

---
 arch/arm/mach-omap1/board-palmte.c |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)
arch/arm/mach-omap1/board-palmte.c +0 -13
index fb51ce6..c9d38f4 100644
@@ -230,19 +230,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = {
 	},
 };
 
-static void palmte_headphones_detect(void *data, int state)
-{
-	if (state) {
-		/* Headphones connected, disable speaker */
-		gpio_set_value(PALMTE_SPEAKER_GPIO, 0);
-		printk(KERN_INFO "PM: speaker off\n");
-	} else {
-		/* Headphones unplugged, re-enable speaker */
-		gpio_set_value(PALMTE_SPEAKER_GPIO, 1);
-		printk(KERN_INFO "PM: speaker on\n");
-	}
-}
-
 static void __init palmte_misc_gpio_setup(void)
 {
 	/* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
Signature · 1 line
1.7.3.4.598.g85356
#3 lore raw

PATCH 3/7 arm: omap1: fix compile warnings

In reply to Felipe Balbi

Fix the following compile warnings:
arch/arm/mach-omap1/board-innovator.c:165:3: warning: initialization makes integer from pointer without a cast arch/arm/mach-omap1/board-perseus2.c:305:3: warning: initialization makes integer from pointer without a cast arch/arm/mach-omap1/board-fsample.c:338:3: warning: initialization makes integer from pointer without a cast

---
 arch/arm/plat-omap/include/plat/fpga.h |   92 ++++++++++++++++----------------
 1 files changed, 46 insertions(+), 46 deletions(-)
arch/arm/plat-omap/include/plat/fpga.h +46 -46
index ae39bcb..bd3c632 100644
@@ -30,18 +30,18 @@ extern void omap1510_fpga_init_irq(void);
  * ---------------------------------------------------------------------------
  */
 /* maps in the FPGA registers and the ETHR registers */
-#define H2P2_DBG_FPGA_BASE		IOMEM(0xE8000000)	/* VA */
+#define H2P2_DBG_FPGA_BASE		0xE8000000		/* VA */
 #define H2P2_DBG_FPGA_SIZE		SZ_4K			/* SIZE */
 #define H2P2_DBG_FPGA_START		0x04000000		/* PA */
 
 #define H2P2_DBG_FPGA_ETHR_START	(H2P2_DBG_FPGA_START + 0x300)
-#define H2P2_DBG_FPGA_FPGA_REV		(H2P2_DBG_FPGA_BASE + 0x10)	/* FPGA Revision */
-#define H2P2_DBG_FPGA_BOARD_REV		(H2P2_DBG_FPGA_BASE + 0x12)	/* Board Revision */
-#define H2P2_DBG_FPGA_GPIO		(H2P2_DBG_FPGA_BASE + 0x14)	/* GPIO outputs */
-#define H2P2_DBG_FPGA_LEDS		(H2P2_DBG_FPGA_BASE + 0x16)	/* LEDs outputs */
-#define H2P2_DBG_FPGA_MISC_INPUTS	(H2P2_DBG_FPGA_BASE + 0x18)	/* Misc inputs */
-#define H2P2_DBG_FPGA_LAN_STATUS	(H2P2_DBG_FPGA_BASE + 0x1A)	/* LAN Status line */
-#define H2P2_DBG_FPGA_LAN_RESET		(H2P2_DBG_FPGA_BASE + 0x1C)	/* LAN Reset line */
+#define H2P2_DBG_FPGA_FPGA_REV		IOMEM(H2P2_DBG_FPGA_BASE + 0x10)	/* FPGA Revision */
+#define H2P2_DBG_FPGA_BOARD_REV		IOMEM(H2P2_DBG_FPGA_BASE + 0x12)	/* Board Revision */
+#define H2P2_DBG_FPGA_GPIO		IOMEM(H2P2_DBG_FPGA_BASE + 0x14)	/* GPIO outputs */
+#define H2P2_DBG_FPGA_LEDS		IOMEM(H2P2_DBG_FPGA_BASE + 0x16)	/* LEDs outputs */
+#define H2P2_DBG_FPGA_MISC_INPUTS	IOMEM(H2P2_DBG_FPGA_BASE + 0x18)	/* Misc inputs */
+#define H2P2_DBG_FPGA_LAN_STATUS	IOMEM(H2P2_DBG_FPGA_BASE + 0x1A)	/* LAN Status line */
+#define H2P2_DBG_FPGA_LAN_RESET		IOMEM(H2P2_DBG_FPGA_BASE + 0x1C)	/* LAN Reset line */
 
 /* NOTE:  most boards don't have a static mapping for the FPGA ... */
 struct h2p2_dbg_fpga {
@@ -81,55 +81,55 @@ struct h2p2_dbg_fpga {
  *  OMAP-1510 FPGA
  * ---------------------------------------------------------------------------
  */
-#define OMAP1510_FPGA_BASE		IOMEM(0xE8000000)	/* VA */
+#define OMAP1510_FPGA_BASE		0xE8000000		/* VA */
 #define OMAP1510_FPGA_SIZE		SZ_4K
 #define OMAP1510_FPGA_START		0x08000000		/* PA */
 
 /* Revision */
-#define OMAP1510_FPGA_REV_LOW			(OMAP1510_FPGA_BASE + 0x0)
-#define OMAP1510_FPGA_REV_HIGH			(OMAP1510_FPGA_BASE + 0x1)
+#define OMAP1510_FPGA_REV_LOW			IOMEM(OMAP1510_FPGA_BASE + 0x0)
+#define OMAP1510_FPGA_REV_HIGH			IOMEM(OMAP1510_FPGA_BASE + 0x1)
 
-#define OMAP1510_FPGA_LCD_PANEL_CONTROL		(OMAP1510_FPGA_BASE + 0x2)
-#define OMAP1510_FPGA_LED_DIGIT			(OMAP1510_FPGA_BASE + 0x3)
-#define INNOVATOR_FPGA_HID_SPI			(OMAP1510_FPGA_BASE + 0x4)
-#define OMAP1510_FPGA_POWER			(OMAP1510_FPGA_BASE + 0x5)
+#define OMAP1510_FPGA_LCD_PANEL_CONTROL		IOMEM(OMAP1510_FPGA_BASE + 0x2)
+#define OMAP1510_FPGA_LED_DIGIT			IOMEM(OMAP1510_FPGA_BASE + 0x3)
+#define INNOVATOR_FPGA_HID_SPI			IOMEM(OMAP1510_FPGA_BASE + 0x4)
+#define OMAP1510_FPGA_POWER			IOMEM(OMAP1510_FPGA_BASE + 0x5)
 
 /* Interrupt status */
-#define OMAP1510_FPGA_ISR_LO			(OMAP1510_FPGA_BASE + 0x6)
-#define OMAP1510_FPGA_ISR_HI			(OMAP1510_FPGA_BASE + 0x7)
+#define OMAP1510_FPGA_ISR_LO			IOMEM(OMAP1510_FPGA_BASE + 0x6)
+#define OMAP1510_FPGA_ISR_HI			IOMEM(OMAP1510_FPGA_BASE + 0x7)
 
 /* Interrupt mask */
-#define OMAP1510_FPGA_IMR_LO			(OMAP1510_FPGA_BASE + 0x8)
-#define OMAP1510_FPGA_IMR_HI			(OMAP1510_FPGA_BASE + 0x9)
+#define OMAP1510_FPGA_IMR_LO			IOMEM(OMAP1510_FPGA_BASE + 0x8)
+#define OMAP1510_FPGA_IMR_HI			IOMEM(OMAP1510_FPGA_BASE + 0x9)
 
 /* Reset registers */
-#define OMAP1510_FPGA_HOST_RESET		(OMAP1510_FPGA_BASE + 0xa)
-#define OMAP1510_FPGA_RST			(OMAP1510_FPGA_BASE + 0xb)
-
-#define OMAP1510_FPGA_AUDIO			(OMAP1510_FPGA_BASE + 0xc)
-#define OMAP1510_FPGA_DIP			(OMAP1510_FPGA_BASE + 0xe)
-#define OMAP1510_FPGA_FPGA_IO			(OMAP1510_FPGA_BASE + 0xf)
-#define OMAP1510_FPGA_UART1			(OMAP1510_FPGA_BASE + 0x14)
-#define OMAP1510_FPGA_UART2			(OMAP1510_FPGA_BASE + 0x15)
-#define OMAP1510_FPGA_OMAP1510_STATUS		(OMAP1510_FPGA_BASE + 0x16)
-#define OMAP1510_FPGA_BOARD_REV			(OMAP1510_FPGA_BASE + 0x18)
-#define OMAP1510P1_PPT_DATA			(OMAP1510_FPGA_BASE + 0x100)
-#define OMAP1510P1_PPT_STATUS			(OMAP1510_FPGA_BASE + 0x101)
-#define OMAP1510P1_PPT_CONTROL			(OMAP1510_FPGA_BASE + 0x102)
-
-#define OMAP1510_FPGA_TOUCHSCREEN		(OMAP1510_FPGA_BASE + 0x204)
-
-#define INNOVATOR_FPGA_INFO			(OMAP1510_FPGA_BASE + 0x205)
-#define INNOVATOR_FPGA_LCD_BRIGHT_LO		(OMAP1510_FPGA_BASE + 0x206)
-#define INNOVATOR_FPGA_LCD_BRIGHT_HI		(OMAP1510_FPGA_BASE + 0x207)
-#define INNOVATOR_FPGA_LED_GRN_LO		(OMAP1510_FPGA_BASE + 0x208)
-#define INNOVATOR_FPGA_LED_GRN_HI		(OMAP1510_FPGA_BASE + 0x209)
-#define INNOVATOR_FPGA_LED_RED_LO		(OMAP1510_FPGA_BASE + 0x20a)
-#define INNOVATOR_FPGA_LED_RED_HI		(OMAP1510_FPGA_BASE + 0x20b)
-#define INNOVATOR_FPGA_CAM_USB_CONTROL		(OMAP1510_FPGA_BASE + 0x20c)
-#define INNOVATOR_FPGA_EXP_CONTROL		(OMAP1510_FPGA_BASE + 0x20d)
-#define INNOVATOR_FPGA_ISR2			(OMAP1510_FPGA_BASE + 0x20e)
-#define INNOVATOR_FPGA_IMR2			(OMAP1510_FPGA_BASE + 0x210)
+#define OMAP1510_FPGA_HOST_RESET		IOMEM(OMAP1510_FPGA_BASE + 0xa)
+#define OMAP1510_FPGA_RST			IOMEM(OMAP1510_FPGA_BASE + 0xb)
+
+#define OMAP1510_FPGA_AUDIO			IOMEM(OMAP1510_FPGA_BASE + 0xc)
+#define OMAP1510_FPGA_DIP			IOMEM(OMAP1510_FPGA_BASE + 0xe)
+#define OMAP1510_FPGA_FPGA_IO			IOMEM(OMAP1510_FPGA_BASE + 0xf)
+#define OMAP1510_FPGA_UART1			IOMEM(OMAP1510_FPGA_BASE + 0x14)
+#define OMAP1510_FPGA_UART2			IOMEM(OMAP1510_FPGA_BASE + 0x15)
+#define OMAP1510_FPGA_OMAP1510_STATUS		IOMEM(OMAP1510_FPGA_BASE + 0x16)
+#define OMAP1510_FPGA_BOARD_REV			IOMEM(OMAP1510_FPGA_BASE + 0x18)
+#define OMAP1510P1_PPT_DATA			IOMEM(OMAP1510_FPGA_BASE + 0x100)
+#define OMAP1510P1_PPT_STATUS			IOMEM(OMAP1510_FPGA_BASE + 0x101)
+#define OMAP1510P1_PPT_CONTROL			IOMEM(OMAP1510_FPGA_BASE + 0x102)
+
+#define OMAP1510_FPGA_TOUCHSCREEN		IOMEM(OMAP1510_FPGA_BASE + 0x204)
+
+#define INNOVATOR_FPGA_INFO			IOMEM(OMAP1510_FPGA_BASE + 0x205)
+#define INNOVATOR_FPGA_LCD_BRIGHT_LO		IOMEM(OMAP1510_FPGA_BASE + 0x206)
+#define INNOVATOR_FPGA_LCD_BRIGHT_HI		IOMEM(OMAP1510_FPGA_BASE + 0x207)
+#define INNOVATOR_FPGA_LED_GRN_LO		IOMEM(OMAP1510_FPGA_BASE + 0x208)
+#define INNOVATOR_FPGA_LED_GRN_HI		IOMEM(OMAP1510_FPGA_BASE + 0x209)
+#define INNOVATOR_FPGA_LED_RED_LO		IOMEM(OMAP1510_FPGA_BASE + 0x20a)
+#define INNOVATOR_FPGA_LED_RED_HI		IOMEM(OMAP1510_FPGA_BASE + 0x20b)
+#define INNOVATOR_FPGA_CAM_USB_CONTROL		IOMEM(OMAP1510_FPGA_BASE + 0x20c)
+#define INNOVATOR_FPGA_EXP_CONTROL		IOMEM(OMAP1510_FPGA_BASE + 0x20d)
+#define INNOVATOR_FPGA_ISR2			IOMEM(OMAP1510_FPGA_BASE + 0x20e)
+#define INNOVATOR_FPGA_IMR2			IOMEM(OMAP1510_FPGA_BASE + 0x210)
 
 #define OMAP1510_FPGA_ETHR_START		(OMAP1510_FPGA_START + 0x300)
 
Signature · 1 line
1.7.3.4.598.g85356
#4 lore raw

PATCH 4/7 arm: omap1: fix a bunch of section mismatches

In reply to Felipe Balbi

Fix the following section mismatches:
WARNING: arch/arm/mach-omap1/built-in.o(.data+0x491c): Section mismatch in reference from the variable fsample_config to the (unknown reference) .init.data:(unknown)
The variable fsample_config references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: arch/arm/mach-omap1/built-in.o(.data+0x8f0c): Section mismatch in reference from the variable ams_delta_config to the (unknown reference) .init.data:(unknown)
The variable ams_delta_config references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: arch/arm/mach-omap1/built-in.o(.data+0x93ac): Section mismatch in reference from the variable ams_delta_camera_device to the (unknown reference) .init.data:(unknown)
The variable ams_delta_camera_device references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: vmlinux.o(.data+0x5e94): Section mismatch in reference from the variable fsample_config to the (unknown reference) .init.data:(unknown) The variable fsample_config references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: vmlinux.o(.data+0xa484): Section mismatch in reference from the variable ams_delta_config to the (unknown reference) .init.data:(unknown)
The variable ams_delta_config references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: vmlinux.o(.data+0xa924): Section mismatch in reference from the variable ams_delta_camera_device to the (unknown reference) .init.data:(unknown)
The variable ams_delta_camera_device references
the (unknown reference) __initdata (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

---
 arch/arm/mach-omap1/board-ams-delta.c |   14 +++++++-------
 arch/arm/mach-omap1/board-fsample.c   |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/mach-omap1/board-ams-delta.c +7 -7
index bd0495a..be2feca 100644
@@ -165,7 +165,7 @@ static struct map_desc ams_delta_io_desc[] __initdata = {
 	}
 };
 
-static struct omap_lcd_config ams_delta_lcd_config __initdata = {
+static struct omap_lcd_config ams_delta_lcd_config = {
 	.ctrl_name	= "internal",
 };
 
@@ -192,14 +192,14 @@ static const struct matrix_keymap_data ams_delta_keymap_data = {
 	.keymap_size	= ARRAY_SIZE(ams_delta_keymap),
 };
 
-static struct omap_kp_platform_data ams_delta_kp_data = {
+static struct omap_kp_platform_data ams_delta_kp_data __initdata = {
 	.rows		= 8,
 	.cols		= 8,
 	.keymap_data	= &ams_delta_keymap_data,
 	.delay		= 9,
 };
 
-static struct platform_device ams_delta_kp_device = {
+static struct platform_device ams_delta_kp_device __initdata = {
 	.name		= "omap-keypad",
 	.id		= -1,
 	.dev		= {
@@ -209,12 +209,12 @@ static struct platform_device ams_delta_kp_device = {
 	.resource	= ams_delta_kp_resources,
 };
 
-static struct platform_device ams_delta_lcd_device = {
+static struct platform_device ams_delta_lcd_device __initdata = {
 	.name	= "lcd_ams_delta",
 	.id	= -1,
 };
 
-static struct platform_device ams_delta_led_device = {
+static struct platform_device ams_delta_led_device __initdata = {
 	.name	= "ams-delta-led",
 	.id	= -1
 };
@@ -243,7 +243,7 @@ static int ams_delta_camera_power(struct device *dev, int power)
 #define ams_delta_camera_power	NULL
 #endif
 
-static struct soc_camera_link __initdata ams_delta_iclink = {
+static struct soc_camera_link ams_delta_iclink __initdata = {
 	.bus_id         = 0,	/* OMAP1 SoC camera bus */
 	.i2c_adapter_id = 1,
 	.board_info     = &ams_delta_camera_board_info[0],
@@ -251,7 +251,7 @@ static struct soc_camera_link __initdata ams_delta_iclink = {
 	.power		= ams_delta_camera_power,
 };
 
-static struct platform_device ams_delta_camera_device = {
+static struct platform_device ams_delta_camera_device __initdata = {
 	.name   = "soc-camera-pdrv",
 	.id     = 0,
 	.dev    = {
arch/arm/mach-omap1/board-fsample.c +1 -1
index 0efb9db..27fb1be 100644
@@ -287,7 +287,7 @@ static struct platform_device *devices[] __initdata = {
 	&lcd_device,
 };
 
-static struct omap_lcd_config fsample_lcd_config __initdata = {
+static struct omap_lcd_config fsample_lcd_config = {
 	.ctrl_name	= "internal",
 };
 
Signature · 1 line
1.7.3.4.598.g85356
#5 lore raw

PATCH 5/7 arm: omap2: mux: fix compile warning

In reply to Felipe Balbi

Fix the following compile warning:
arch/arm/mach-omap2/mux.c: In function '_omap_mux_get_by_name':
arch/arm/mach-omap2/mux.c:163:17: warning: 'found_mode' may be used uninitialized in this function

---
 arch/arm/mach-omap2/mux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mux.c +1 -1
index df8d2f2..fae49d1 100644
@@ -160,7 +160,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
 	struct omap_mux *mux = NULL;
 	struct omap_mux_entry *e;
 	const char *mode_name;
-	int found = 0, found_mode, mode0_len = 0;
+	int found = 0, found_mode = 0, mode0_len = 0;
 	struct list_head *muxmodes = &partition->muxmodes;
 
 	mode_name = strchr(muxname, '.');
Signature · 1 line
1.7.3.4.598.g85356
#6 lore raw

PATCH 6/7 arm: omap2: irq: fix compile warning:

In reply to Felipe Balbi

Fix the following compile warning:
arch/arm/mach-omap2/irq.c:64:31: warning: 'intc_context' defined but not used

---
 arch/arm/mach-omap2/irq.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/irq.c +2 -2
index 23049c4..d151aac 100644
@@ -61,8 +61,6 @@ struct omap3_intc_regs {
 	u32 mir[INTCPS_NR_MIR_REGS];
 };
 
-static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
-
 /* INTC bank register get/set */
 
 static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg)
@@ -229,6 +227,8 @@ void __init omap_init_irq(void)
 }
 
 #ifdef CONFIG_ARCH_OMAP3
+static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
+
 void omap_intc_save_context(void)
 {
 	int ind = 0, i = 0;
Signature · 1 line
1.7.3.4.598.g85356
#7 lore raw

PATCH 7/7 arm: omap2: clksel: fix compile warning

In reply to Felipe Balbi

Fix the following compile warning:
arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be used uninitialized in this function

While at that, also add a check to avoid using max_clkr while NULL.

---
 arch/arm/mach-omap2/clkt_clksel.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clkt_clksel.c +4 -1
index a781cd6..baf0b6b 100644
@@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 				u32 *field_val)
 {
 	const struct clksel *clks;
-	const struct clksel_rate *clkr, *max_clkr;
+	const struct clksel_rate *clkr, *max_clkr = NULL;
 	u8 max_div = 0;
 
 	clks = _get_clksel_by_parent(clk, src_clk);
@@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 		}
 	}
 
+	if (!max_clkr)
+		return 0;
+
 	if (max_div == 0) {
 		/* This indicates an error in the clksel data */
 		WARN(1, "clock: Could not find divisor for clock %s parent %s"
Signature · 1 line
1.7.3.4.598.g85356
#8 lore raw

PATCH 7/7 arm: omap2: clksel: fix compile warning

Quoted 26 lines · Felipe Balbi

Fix the following compile warning:
arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be used uninitialized in this function

While at that, also add a check to avoid using max_clkr while NULL.

---
?arch/arm/mach-omap2/clkt_clksel.c | ? ?5 ++++-
?1 files changed, 4 insertions(+), 1 deletions(-)

arch/arm/mach-omap2/clkt_clksel.c +1 -1
index a781cd6..baf0b6b 100644
@@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?u32 *field_val)
 ?{
 ? ? ? ?const struct clksel *clks;
- ? ? ? const struct clksel_rate *clkr, *max_clkr;
+ ? ? ? const struct clksel_rate *clkr, *max_clkr = NULL;
 ? ? ? ?u8 max_div = 0;
 
 ? ? ? ?clks = _get_clksel_by_parent(clk, src_clk);

arch/arm/mach-omap2/clkt_clksel.c static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk, · line 127

Quoted 5 lines
arch/arm/mach-omap2/clkt_clksel.c +2 -0
@@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 ? ? ? ? ? ? ? ?}
 ? ? ? ?}
 
+ ? ? ? if (!max_clkr)
+ ? ? ? ? ? ? ? return 0;

Would it be more appropriate to move this check after the "if" check of max_div==0 and it's warning?
or add a warning before it returns?

Quoted 7 lines
arch/arm/mach-omap2/clkt_clksel.c +1 -0
+
 ? ? ? ?if (max_div == 0) {

? ? ? ? ? ? ? ?/* This indicates an error in the clksel data */
? ? ? ? ? ? ? ?WARN(1, "clock: Could not find divisor for clock %s parent %s" --
1.7.3.4.598.g85356

#9 lore raw

PATCH 7/7 arm: omap2: clksel: fix compile warning

Hi,

Quoted 30 lines · Charulatha
Quoted 29 lines · Felipe Balbi

Fix the following compile warning:
arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be used uninitialized in this function

While at that, also add a check to avoid using max_clkr while NULL.

---
?arch/arm/mach-omap2/clkt_clksel.c | ? ?5 ++++-
?1 files changed, 4 insertions(+), 1 deletions(-)

arch/arm/mach-omap2/clkt_clksel.c +1 -1
index a781cd6..baf0b6b 100644
@@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?u32 *field_val)
 ?{
 ? ? ? ?const struct clksel *clks;
- ? ? ? const struct clksel_rate *clkr, *max_clkr;
+ ? ? ? const struct clksel_rate *clkr, *max_clkr = NULL;
 ? ? ? ?u8 max_div = 0;
 
 ? ? ? ?clks = _get_clksel_by_parent(clk, src_clk);
@@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 ? ? ? ? ? ? ? ?}
 ? ? ? ?}
 
Quoted 6 lines

arch/arm/mach-omap2/clkt_clksel.c static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk, · line 127

Quoted 2 lines
arch/arm/mach-omap2/clkt_clksel.c +2 -0
+ ? ? ? if (!max_clkr)
+ ? ? ? ? ? ? ? return 0;

Would it be more appropriate to move this check after the "if" check of max_div==0 and it's warning?
or add a warning before it returns?

Maybe this return isn't even necessary. max_clkr will be true if max_div is valid, so they cancel each other.

Tony ?

Signature · 1 line
balbi
maintainer
#10 lore raw

PATCH 7/7 arm: omap2: clksel: fix compile warning

Quoted 40 lines · Felipe Balbi

Hi,

Quoted 30 lines · Charulatha
Quoted 29 lines · Felipe Balbi

Fix the following compile warning:
arch/arm/mach-omap2/clkt_clksel.c: In function '_get_div_and_fieldval':
arch/arm/mach-omap2/clkt_clksel.c:100:35: warning: 'max_clkr' may be used uninitialized in this function

While at that, also add a check to avoid using max_clkr while NULL.

---
?arch/arm/mach-omap2/clkt_clksel.c | ? ?5 ++++-
?1 files changed, 4 insertions(+), 1 deletions(-)

arch/arm/mach-omap2/clkt_clksel.c +1 -1
index a781cd6..baf0b6b 100644
@@ -97,7 +97,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?u32 *field_val)
 ?{
 ? ? ? ?const struct clksel *clks;
- ? ? ? const struct clksel_rate *clkr, *max_clkr;
+ ? ? ? const struct clksel_rate *clkr, *max_clkr = NULL;
 ? ? ? ?u8 max_div = 0;
 
 ? ? ? ?clks = _get_clksel_by_parent(clk, src_clk);
@@ -123,6 +123,9 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
 ? ? ? ? ? ? ? ?}
 ? ? ? ?}
 
Quoted 6 lines

arch/arm/mach-omap2/clkt_clksel.c static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk, · line 127

Quoted 2 lines
arch/arm/mach-omap2/clkt_clksel.c +2 -0
+ ? ? ? if (!max_clkr)
+ ? ? ? ? ? ? ? return 0;

Would it be more appropriate to move this check after the "if" check of max_div==0 and it's warning?
or add a warning before it returns?

Quoted 4 lines

Maybe this return isn't even necessary. max_clkr will be true if max_div is valid, so they cancel each other.

Tony ?

Looks like the max_div test should catch it to me. Paul?

Tony

maintainer
#11 lore raw

cover OMAP compile warning fix

In reply to Felipe Balbi
Quoted 5 lines · Felipe Balbi

Hi Tony,

I gave it a shot at dropping a few compile warnings from omap1-only and omap2-only builds.

Quoted 8 lines

Following are 7 patches which I came up with. All compile tested with omap1_defconfig and omap2_defconfig (the latter being a result of omap2plus_defconfig - omap3 and omap4 support and adding any other config option which was disabled)

There are a few more warnings to clean up, though. I didn't tackle all of them.

Thanks, adding all but the last one into devel-cleanup for the next merge window. Let's see what Paul says about the last one.

Tony