Skip to content

Commit 7530fbc

Browse files
arndbgregkh
authored andcommitted
fbdev: omapfb: avoid stack overflow warning
[ Upstream commit 634cf6e ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e1df7f0 commit 7530fbc

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
@@ -1538,22 +1538,28 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
15381538
{
15391539
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
15401540
unsigned long flags;
1541-
struct dsi_irq_stats stats;
1541+
struct dsi_irq_stats *stats;
1542+
1543+
stats = kzalloc(sizeof(*stats), GFP_KERNEL);
1544+
if (!stats) {
1545+
seq_printf(s, "out of memory\n");
1546+
return;
1547+
}
15421548

15431549
spin_lock_irqsave(&dsi->irq_stats_lock, flags);
15441550

1545-
stats = dsi->irq_stats;
1551+
*stats = dsi->irq_stats;
15461552
memset(&dsi->irq_stats, 0, sizeof(dsi->irq_stats));
15471553
dsi->irq_stats.last_reset = jiffies;
15481554

15491555
spin_unlock_irqrestore(&dsi->irq_stats_lock, flags);
15501556

15511557
seq_printf(s, "period %u ms\n",
1552-
jiffies_to_msecs(jiffies - stats.last_reset));
1558+
jiffies_to_msecs(jiffies - stats->last_reset));
15531559

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

15581564
seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1);
15591565
PIS(VC0);
@@ -1577,10 +1583,10 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
15771583

15781584
#define PIS(x) \
15791585
seq_printf(s, "%-20s %10d %10d %10d %10d\n", #x, \
1580-
stats.vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \
1581-
stats.vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \
1582-
stats.vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \
1583-
stats.vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]);
1586+
stats->vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \
1587+
stats->vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \
1588+
stats->vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \
1589+
stats->vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]);
15841590

15851591
seq_printf(s, "-- VC interrupts --\n");
15861592
PIS(CS);
@@ -1596,7 +1602,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
15961602

15971603
#define PIS(x) \
15981604
seq_printf(s, "%-20s %10d\n", #x, \
1599-
stats.cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]);
1605+
stats->cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]);
16001606

16011607
seq_printf(s, "-- CIO interrupts --\n");
16021608
PIS(ERRSYNCESC1);
@@ -1620,6 +1626,8 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
16201626
PIS(ULPSACTIVENOT_ALL0);
16211627
PIS(ULPSACTIVENOT_ALL1);
16221628
#undef PIS
1629+
1630+
kfree(stats);
16231631
}
16241632

16251633
static void dsi1_dump_irqs(struct seq_file *s)

0 commit comments

Comments
 (0)