Skip to content

Commit dc6ecba

Browse files
arndbgregkh
authored andcommitted
pvrusb2: reduce stack usage pvr2_eeprom_analyze()
commit 6830733d53a4517588e56227b9c8538633f0c496 upstream. The driver uses a relatively large data structure on the stack, which showed up on my radar as we get a warning with the "latent entropy" GCC plugin: drivers/media/usb/pvrusb2/pvrusb2-eeprom.c:153:1: error: the frame size of 1376 bytes is larger than 1152 bytes [-Werror=frame-larger-than=] The warning is usually hidden as we raise the warning limit to 2048 when the plugin is enabled, but I'd like to lower that again in the future, and making this function smaller helps to do that without build regressions. Further analysis shows that putting an 'i2c_client' structure on the stack is not really supported, as the embedded 'struct device' is not initialized here, and we are only saved by the fact that the function that is called here does not use the pointer at all. Fixes: d855497 ("V4L/DVB (4228a): pvrusb2 to kernel 2.6.18") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e33e866 commit dc6ecba

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

drivers/media/usb/pvrusb2/pvrusb2-eeprom.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,10 @@ int pvr2_eeprom_analyze(struct pvr2_hdw *hdw)
123123
memset(&tvdata,0,sizeof(tvdata));
124124

125125
eeprom = pvr2_eeprom_fetch(hdw);
126-
if (!eeprom) return -EINVAL;
127-
128-
{
129-
struct i2c_client fake_client;
130-
/* Newer version expects a useless client interface */
131-
fake_client.addr = hdw->eeprom_addr;
132-
fake_client.adapter = &hdw->i2c_adap;
133-
tveeprom_hauppauge_analog(&fake_client,&tvdata,eeprom);
134-
}
126+
if (!eeprom)
127+
return -EINVAL;
128+
129+
tveeprom_hauppauge_analog(NULL, &tvdata, eeprom);
135130

136131
trace_eeprom("eeprom assumed v4l tveeprom module");
137132
trace_eeprom("eeprom direct call results:");

0 commit comments

Comments
 (0)