Skip to contentSkip to conversation

ARM: pxafb: Fix access to nonexistent member of pxafb_info

PATCH New Marek Vasut 3 participants 5 messages Mar 22, 2011 – Mar 26, 2011 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: pxafb: Fix access to nonexistent member of pxafb_info

In case CONFIG_FB_PXA_OVERLAY is not defined, the pxafb_freq_transition() function tests nonexistent member of pxafb_info (since the member is not part of the structure).

Fix this by wraping the test in ifdef, even if I don't really like how the code looks now. The check doesn't have to happen if overlays are disabled at all as the check is always true then.

---
 drivers/video/pxafb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/video/pxafb.c +3 -1
index a2e5b51..0f4e8c9 100644
@@ -1648,7 +1648,9 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
 
 	switch (val) {
 	case CPUFREQ_PRECHANGE:
-		if (!fbi->overlay[0].usage && !fbi->overlay[1].usage)
+#ifdef CONFIG_FB_PXA_OVERLAY
+		if (!(fbi->overlay[0].usage || fbi->overlay[1].usage))
+#endif
 			set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
 		break;
 
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/1 ARM: pxafb: Fix access to nonexistent member of pxafb_info

Quoted 6 lines · On Tuesday 22 March 2011 14:14:14 Marek Vasut wrote:

In case CONFIG_FB_PXA_OVERLAY is not defined, the pxafb_freq_transition() function tests nonexistent member of pxafb_info (since the member is not part of the structure).
Fix this by wraping the test in ifdef, even if I don't really like how the code looks now. The check doesn't have to happen if overlays are disabled at all as the check is always true then.

Ok, but how you're going to implement it if overlay support is enabled, but SoC does not support it?

Quoted 1 line
Quoted 19 lines
---
 drivers/video/pxafb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/video/pxafb.c +3 -1
index a2e5b51..0f4e8c9 100644
@@ -1648,7 +1648,9 @@ pxafb_freq_transition(struct notifier_block *nb,
 unsigned long val, void *data)
 
 	switch (val) {
 	case CPUFREQ_PRECHANGE:
-		if (!fbi->overlay[0].usage && !fbi->overlay[1].usage)
+#ifdef CONFIG_FB_PXA_OVERLAY
+		if (!(fbi->overlay[0].usage || fbi->overlay[1].usage))
+#endif
 			set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
 		break;
#2 lore raw

PATCH 1/1 ARM: pxafb: Fix access to nonexistent member of pxafb_info

Quoted 10 lines · On Wednesday 23 March 2011 10:15:52 Vasily Khoruzhick wrote:
Quoted 6 lines · On Tuesday 22 March 2011 14:14:14 Marek Vasut wrote:

In case CONFIG_FB_PXA_OVERLAY is not defined, the pxafb_freq_transition() function tests nonexistent member of pxafb_info (since the member is not part of the structure).
Fix this by wraping the test in ifdef, even if I don't really like how the code looks now. The check doesn't have to happen if overlays are disabled at all as the check is always true then.

Ok, but how you're going to implement it if overlay support is enabled, but SoC does not support it?

Implement what ? The member doesn't exist in the structure so it doesn't even compile with overlays disabled.

Quoted 28 lines
Quoted 2 lines
Quoted 23 lines

---

 drivers/video/pxafb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/video/pxafb.c +3 -1
index a2e5b51..0f4e8c9 100644
@@ -1648,7 +1648,9 @@ pxafb_freq_transition(struct notifier_block *nb,
 unsigned long val, void *data)
 
 	switch (val) {
 
 	case CPUFREQ_PRECHANGE:
-		if (!fbi->overlay[0].usage && !fbi->overlay[1].usage)
+#ifdef CONFIG_FB_PXA_OVERLAY
+		if (!(fbi->overlay[0].usage || fbi->overlay[1].usage))
+#endif
 
drivers/video/pxafb.c +0 -0
 			set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
 
 		break;
#3 lore raw

PATCH 1/1 ARM: pxafb: Fix access to nonexistent member of pxafb_info

Quoted 2 lines · On Wednesday 23 March 2011 16:54:36 Marek Vasut wrote:

Implement what ? The member doesn't exist in the structure so it doesn't even compile with overlays disabled.

Hm, sorry, I thought you also don't like that check is performed on SoCs without overlays (PXA250/PXA260) when overlay support is compiled in.

I understand that it does not compile at all when CONFIG_FB_PXA_OVERLAY is not set.

Regards
Vasily

#4 lore raw

PATCH 1/1 ARM: pxafb: Fix access to nonexistent member of pxafb_info

Merged with Vasily's Ack. On SoCs where there is no overlay HW yet the support has been built into the kernel, the overlay[0/1].usage will just be zero(s).

Quoted 14 lines · Vasily Khoruzhick
Quoted 2 lines · On Wednesday 23 March 2011 16:54:36 Marek Vasut wrote:

Implement what ? The member doesn't exist in the structure so it doesn't even compile with overlays disabled.

Hm, sorry, I thought you also don't like that check is performed on SoCs without overlays (PXA250/PXA260) when overlay support is compiled in.

I understand that it does not compile at all when CONFIG_FB_PXA_OVERLAY is not set.

Regards
Vasily