Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0df4d8ef authored by Ian Munsie's avatar Ian Munsie Committed by Greg Kroah-Hartman
Browse files

USB: Remove large struct from the stack in USB storage isd200 driver



The compiler throws the following warning when compiling for a PowerPC 64
bit machine:

drivers/usb/storage/isd200.c:580: warning: the frame size of 2208 bytes is larger than 2048 bytes

There is a struct scsi_device which is placed on the stack and is
largely responsible for such wastage. The struct is just a dummy struct
filled with NULLs and set as the scsi_cmnd->device to make the
usb_stor_Bulk_transport function happy.

This patch makes the struct static, so that it is never placed onto the
stack and silences the compiler warning.

Signed-off-by: default avatarIan Munsie <imunsie@au.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fa4dc364
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -490,13 +490,13 @@ static int isd200_action( struct us_data *us, int action,
			  void* pointer, int value )
			  void* pointer, int value )
{
{
	union ata_cdb ata;
	union ata_cdb ata;
	struct scsi_device srb_dev;
	/* static to prevent this large struct being placed on the valuable stack */
	static struct scsi_device srb_dev;
	struct isd200_info *info = (struct isd200_info *)us->extra;
	struct isd200_info *info = (struct isd200_info *)us->extra;
	struct scsi_cmnd *srb = &info->srb;
	struct scsi_cmnd *srb = &info->srb;
	int status;
	int status;


	memset(&ata, 0, sizeof(ata));
	memset(&ata, 0, sizeof(ata));
	memset(&srb_dev, 0, sizeof(srb_dev));
	srb->cmnd = info->cmnd;
	srb->cmnd = info->cmnd;
	srb->device = &srb_dev;
	srb->device = &srb_dev;
	++srb->serial_number;
	++srb->serial_number;