Re: [PATCHv2 2/4] pci: No config access for removed devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 07, 2016 at 08:03:32PM +0800, kbuild test robot wrote:
> All errors (new ones prefixed by >>):
> 
>    arch/mips/txx9/generic/pci.c: In function 'early_read_config_word':
> >> arch/mips/txx9/generic/pci.c:49:1: error: the frame size of 1528 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>     }
>     ^
>
>    cc1: all warnings being treated as errors
> 
> vim +49 arch/mips/txx9/generic/pci.c
> 
> 89d63fe1 Atsushi Nemoto 2008-07-11  33  	struct pci_bus fake_bus;
> 89d63fe1 Atsushi Nemoto 2008-07-11  34  
> 89d63fe1 Atsushi Nemoto 2008-07-11  35  	fake_dev.bus = &fake_bus;
> 89d63fe1 Atsushi Nemoto 2008-07-11  36  	fake_dev.sysdata = hose;
> 89d63fe1 Atsushi Nemoto 2008-07-11  37  	fake_dev.devfn = devfn;
> 89d63fe1 Atsushi Nemoto 2008-07-11  38  	fake_bus.number = bus;
> 89d63fe1 Atsushi Nemoto 2008-07-11  39  	fake_bus.sysdata = hose;
> 89d63fe1 Atsushi Nemoto 2008-07-11  40  	fake_bus.ops = hose->pci_ops;
> 89d63fe1 Atsushi Nemoto 2008-07-11  41  
> 89d63fe1 Atsushi Nemoto 2008-07-11  42  	if (bus != top_bus)
> 89d63fe1 Atsushi Nemoto 2008-07-11  43  		/* Fake a parent bus structure. */
> 89d63fe1 Atsushi Nemoto 2008-07-11  44  		fake_bus.parent = &fake_bus;
> 89d63fe1 Atsushi Nemoto 2008-07-11  45  	else
> 89d63fe1 Atsushi Nemoto 2008-07-11  46  		fake_bus.parent = NULL;
> 89d63fe1 Atsushi Nemoto 2008-07-11  47  
> 89d63fe1 Atsushi Nemoto 2008-07-11  48  	return pci_read_config_word(&fake_dev, offset, value);
> 89d63fe1 Atsushi Nemoto 2008-07-11 @49  }


Hmm, why is this function allocating such large structures on the
stack? It looks like the size of struct pci_dev and struct pci_bus
already exceeded 1024 bytes.

I have no hardware to test this, but it looks to me there is no reason to
have struct pci_dev and the following should save quite a bite of space:

---
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 1f6bc9a..285d84e 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -29,12 +29,8 @@ static int __init
 early_read_config_word(struct pci_controller *hose,
 		       int top_bus, int bus, int devfn, int offset, u16 *value)
 {
-	struct pci_dev fake_dev;
 	struct pci_bus fake_bus;
 
-	fake_dev.bus = &fake_bus;
-	fake_dev.sysdata = hose;
-	fake_dev.devfn = devfn;
 	fake_bus.number = bus;
 	fake_bus.sysdata = hose;
 	fake_bus.ops = hose->pci_ops;
@@ -45,7 +41,7 @@ early_read_config_word(struct pci_controller *hose,
 	else
 		fake_bus.parent = NULL;
 
-	return pci_read_config_word(&fake_dev, offset, value);
+	return pci_bus_read_config_word(&fake_bus, devfn, offset, value);
 }
 
 int __init txx9_pci66_check(struct pci_controller *hose, int top_bus,
--
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux