tty: rocket: reduce stack usage
The build of xtensa allmodconfig gives warning of: In function 'get_ports.isra.0': warning: the frame size of 1040 bytes is larger than 1024 bytes Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Acked-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20191018161712.27807-1-sudipm.mukherjee@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5bfb263036
commit
4d2c82b192
|
@ -1222,22 +1222,28 @@ static int set_config(struct tty_struct *tty, struct r_port *info,
|
||||||
*/
|
*/
|
||||||
static int get_ports(struct r_port *info, struct rocket_ports __user *retports)
|
static int get_ports(struct r_port *info, struct rocket_ports __user *retports)
|
||||||
{
|
{
|
||||||
struct rocket_ports tmp;
|
struct rocket_ports *tmp;
|
||||||
int board;
|
int board, ret = 0;
|
||||||
|
|
||||||
memset(&tmp, 0, sizeof (tmp));
|
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
|
||||||
tmp.tty_major = rocket_driver->major;
|
if (!tmp)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
tmp->tty_major = rocket_driver->major;
|
||||||
|
|
||||||
for (board = 0; board < 4; board++) {
|
for (board = 0; board < 4; board++) {
|
||||||
tmp.rocketModel[board].model = rocketModel[board].model;
|
tmp->rocketModel[board].model = rocketModel[board].model;
|
||||||
strcpy(tmp.rocketModel[board].modelString, rocketModel[board].modelString);
|
strcpy(tmp->rocketModel[board].modelString,
|
||||||
tmp.rocketModel[board].numPorts = rocketModel[board].numPorts;
|
rocketModel[board].modelString);
|
||||||
tmp.rocketModel[board].loadrm2 = rocketModel[board].loadrm2;
|
tmp->rocketModel[board].numPorts = rocketModel[board].numPorts;
|
||||||
tmp.rocketModel[board].startingPortNumber = rocketModel[board].startingPortNumber;
|
tmp->rocketModel[board].loadrm2 = rocketModel[board].loadrm2;
|
||||||
|
tmp->rocketModel[board].startingPortNumber =
|
||||||
|
rocketModel[board].startingPortNumber;
|
||||||
}
|
}
|
||||||
if (copy_to_user(retports, &tmp, sizeof (*retports)))
|
if (copy_to_user(retports, tmp, sizeof(*retports)))
|
||||||
return -EFAULT;
|
ret = -EFAULT;
|
||||||
return 0;
|
kfree(tmp);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reset_rm2(struct r_port *info, void __user *arg)
|
static int reset_rm2(struct r_port *info, void __user *arg)
|
||||||
|
|
Loading…
Reference in New Issue