* [PATCH -next v2] media: tuners: reduce stack usage in mxl5005s_reconfigure
2020-07-16 17:17 [PATCH] media: tuners: reduce stack usage in mxl5005s_reconfigure Bixuan Cui
@ 2020-07-16 13:48 ` Bixuan Cui
0 siblings, 0 replies; 2+ messages in thread
From: Bixuan Cui @ 2020-07-16 13:48 UTC (permalink / raw)
To: linux-next, mchehab; +Cc: linux-kernel, linux-media, john.wanghui
Fix the warning: [-Werror=-Wframe-larger-than=]
drivers/media/tuners/mxl5005s.c: In function 'mxl5005s_reconfigure':
drivers/media/tuners/mxl5005s.c:3953:1:
warning: the frame size of 1152 bytes is larger than 1024 bytes
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
drivers/media/tuners/mxl5005s.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/media/tuners/mxl5005s.c b/drivers/media/tuners/mxl5005s.c
index 1c07e2225fb3..f6e82a8e7d37 100644
--- a/drivers/media/tuners/mxl5005s.c
+++ b/drivers/media/tuners/mxl5005s.c
@@ -3926,15 +3926,26 @@ static int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type,
u32 bandwidth)
{
struct mxl5005s_state *state = fe->tuner_priv;
-
- u8 AddrTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
- u8 ByteTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
+ u8 *AddrTable;
+ u8 *ByteTable;
int TableLen;
dprintk(1, "%s(type=%d, bw=%d)\n", __func__, mod_type, bandwidth);
mxl5005s_reset(fe);
+ AddrTable = kcalloc(MXL5005S_REG_WRITING_TABLE_LEN_MAX, sizeof(u8),
+ GFP_KERNEL);
+ if (!AddrTable)
+ return -ENOMEM;
+
+ ByteTable = kcalloc(MXL5005S_REG_WRITING_TABLE_LEN_MAX, sizeof(u8),
+ GFP_KERNEL);
+ if (!ByteTable) {
+ kfree(AddrTable);
+ return -ENOMEM;
+ }
+
/* Tuner initialization stage 0 */
MXL_GetMasterControl(ByteTable, MC_SYNTH_RESET);
AddrTable[0] = MASTER_CONTROL_ADDR;
@@ -3949,6 +3960,9 @@ static int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type,
mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen);
+ kfree(AddrTable);
+ kfree(ByteTable);
+
return 0;
}
--
2.17.1
.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] media: tuners: reduce stack usage in mxl5005s_reconfigure
@ 2020-07-16 17:17 Bixuan Cui
2020-07-16 13:48 ` [PATCH -next v2] " Bixuan Cui
0 siblings, 1 reply; 2+ messages in thread
From: Bixuan Cui @ 2020-07-16 17:17 UTC (permalink / raw)
To: linux-next; +Cc: linux-kernel, linux-media, mchehab, john.wanghui
Fix the warning: [-Werror=-Wframe-larger-than=]
drivers/media/tuners/mxl5005s.c: In function 'mxl5005s_reconfigure':
drivers/media/tuners/mxl5005s.c:3953:1:
warning: the frame size of 1152 bytes is larger than 1024 bytes
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
drivers/media/tuners/mxl5005s.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/media/tuners/mxl5005s.c b/drivers/media/tuners/mxl5005s.c
index 1c07e2225fb3..f6e82a8e7d37 100644
--- a/drivers/media/tuners/mxl5005s.c
+++ b/drivers/media/tuners/mxl5005s.c
@@ -3926,15 +3926,26 @@ static int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type,
u32 bandwidth)
{
struct mxl5005s_state *state = fe->tuner_priv;
-
- u8 AddrTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
- u8 ByteTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX];
+ u8 *AddrTable;
+ u8 *ByteTable;
int TableLen;
dprintk(1, "%s(type=%d, bw=%d)\n", __func__, mod_type, bandwidth);
mxl5005s_reset(fe);
+ AddrTable = kcalloc(MXL5005S_REG_WRITING_TABLE_LEN_MAX, sizeof(u8),
+ GFP_KERNEL);
+ if (!AddrTable)
+ return -ENOMEM;
+
+ ByteTable = kcalloc(MXL5005S_REG_WRITING_TABLE_LEN_MAX, sizeof(u8),
+ GFP_KERNEL);
+ if (!ByteTable) {
+ kfree(AddrTable);
+ return -ENOMEM;
+ }
+
/* Tuner initialization stage 0 */
MXL_GetMasterControl(ByteTable, MC_SYNTH_RESET);
AddrTable[0] = MASTER_CONTROL_ADDR;
@@ -3949,6 +3960,9 @@ static int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type,
mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen);
+ kfree(AddrTable);
+ kfree(ByteTable);
+
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-16 13:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 17:17 [PATCH] media: tuners: reduce stack usage in mxl5005s_reconfigure Bixuan Cui
2020-07-16 13:48 ` [PATCH -next v2] " Bixuan Cui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).