Skip to content

Commit 634cf6e

Browse files
arndbhdeller
authored andcommitted
fbdev: omapfb: avoid stack overflow warning
The dsi_irq_stats structure is a little too big to fit on the stack of a 32-bit task, depending on the specific gcc options: fbdev/omap2/omapfb/dss/dsi.c: In function 'dsi_dump_dsidev_irqs': fbdev/omap2/omapfb/dss/dsi.c:1621:1: error: the frame size of 1064 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Since this is only a debugfs file, performance is not critical, so just dynamically allocate it, and print an error message in there in place of a failure code when the allocation fails. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent f685dd7 commit 634cf6e

File tree

1 file changed

+18
-10
lines changed
  • drivers/video/fbdev/omap2/omapfb/dss

1 file changed

+18
-10
lines changed

drivers/video/fbdev/omap2/omapfb/dss/dsi.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,22 +1536,28 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
15361536
{
15371537
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
15381538
unsigned long flags;
1539-
struct dsi_irq_stats stats;
1539+
struct dsi_irq_stats *stats;
1540+
1541+
stats = kzalloc(sizeof(*stats), GFP_KERNEL);
1542+
if (!stats) {
1543+
seq_printf(s, "out of memory\n");
1544+
return;
1545+
}
15401546

15411547
spin_lock_irqsave(&dsi->irq_stats_lock, flags);
15421548

1543-
stats = dsi->irq_stats;
1549+
*stats = dsi->irq_stats;
15441550
memset(&dsi->irq_stats, 0, sizeof(dsi->irq_stats));
15451551
dsi->irq_stats.last_reset = jiffies;
15461552

15471553
spin_unlock_irqrestore(&dsi->irq_stats_lock, flags);
15481554

15491555
seq_printf(s, "period %u ms\n",
1550-
jiffies_to_msecs(jiffies - stats.last_reset));
1556+
jiffies_to_msecs(jiffies - stats->last_reset));
15511557

1552-
seq_printf(s, "irqs %d\n", stats.irq_count);
1558+
seq_printf(s, "irqs %d\n", stats->irq_count);
15531559
#define PIS(x) \
1554-
seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1])
1560+
seq_printf(s, "%-20s %10d\n", #x, stats->dsi_irqs[ffs(DSI_IRQ_##x)-1])
15551561

15561562
seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1);
15571563
PIS(VC0);
@@ -1575,10 +1581,10 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
15751581

15761582
#define PIS(x) \
15771583
seq_printf(s, "%-20s %10d %10d %10d %10d\n", #x, \
1578-
stats.vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \
1579-
stats.vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \
1580-
stats.vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \
1581-
stats.vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]);
1584+
stats->vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \
1585+
stats->vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \
1586+
stats->vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \
1587+
stats->vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]);
15821588

15831589
seq_printf(s, "-- VC interrupts --\n");
15841590
PIS(CS);
@@ -1594,7 +1600,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
15941600

15951601
#define PIS(x) \
15961602
seq_printf(s, "%-20s %10d\n", #x, \
1597-
stats.cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]);
1603+
stats->cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]);
15981604

15991605
seq_printf(s, "-- CIO interrupts --\n");
16001606
PIS(ERRSYNCESC1);
@@ -1618,6 +1624,8 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
16181624
PIS(ULPSACTIVENOT_ALL0);
16191625
PIS(ULPSACTIVENOT_ALL1);
16201626
#undef PIS
1627+
1628+
kfree(stats);
16211629
}
16221630

16231631
static void dsi1_dump_irqs(struct seq_file *s)

0 commit comments

Comments
 (0)