]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: mxl5005s: reduce stack usage in MXL5005_ControlInit
authorArnd Bergmann <arnd@arndb.de>
Fri, 20 Jun 2025 11:14:23 +0000 (13:14 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Mon, 16 Mar 2026 10:51:54 +0000 (11:51 +0100)
This function initializes two large structures with arrays. On at least
parisc, the specific code sequence here leads to a badly misoptimized
output from the compiler along with a warning about the resulting
excessive stack usage from many spilled variables:

drivers/media/tuners/mxl5005s.c: In function 'MXL5005_ControlInit.isra':
drivers/media/tuners/mxl5005s.c:1660:1: warning: the frame size of 1400 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Splitting this one function into two functions avoids this because there
are few temporaries that can be spilled to the stack in each of the smaller
structures, so this avoids the warning and also improves readability.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/tuners/mxl5005s.c

index ba22bf594ac7134cca3965606c617d5227ce317e..d57570290e9313fb9c3fc4fe1e6cc66934399163 100644 (file)
@@ -1174,7 +1174,12 @@ static u16 MXL5005_ControlInit(struct dvb_frontend *fe)
        state->Init_Ctrl[39].bit[0] = 3;
        state->Init_Ctrl[39].val[0] = 1;
 
+       return 0;
+}
 
+static u16 MXL5005_ControlInitCH(struct dvb_frontend *fe)
+{
+       struct mxl5005s_state *state = fe->tuner_priv;
        state->CH_Ctrl_Num = CHCTRL_NUM ;
 
        state->CH_Ctrl[0].Ctrl_Num = DN_POLY ;
@@ -1663,6 +1668,7 @@ static void InitTunerControls(struct dvb_frontend *fe)
 {
        MXL5005_RegisterInit(fe);
        MXL5005_ControlInit(fe);
+       MXL5005_ControlInitCH(fe);
 #ifdef _MXL_INTERNAL
        MXL5005_MXLControlInit(fe);
 #endif