linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@freescale.com>
To: Scott Wood <scottwood@freescale.com>
Cc: Wang Dongsheng <dongsheng.wang@freescale.com>,
	linux-kernel@vger.kernel.org,
	Himangi Saraogi <himangi774@gmail.com>,
	Anton Blanchard <anton@samba.org>,
	Paul Mackerras <paulus@samba.org>,
	Aaron Sierra <asierra@xes-inc.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
Date: Wed, 21 Jan 2015 20:48:44 -0600	[thread overview]
Message-ID: <20150121204844.fda3d4ab23a8226b6cdfdaf6@freescale.com> (raw)
In-Reply-To: <1421800292.4961.215.camel@freescale.com>

On Tue, 20 Jan 2015 18:31:32 -0600
Scott Wood <scottwood@freescale.com> wrote:

> On Tue, 2015-01-20 at 14:03 -0600, Kim Phillips wrote:
> > Fix this:
> > 
> >   CC      arch/powerpc/sysdev/fsl_pci.o
> > arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
> > arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> > 
> > when configuring FRAME_WARN, by converting the allocation from the
> > stack to the heap.  We use GFP_ATOMIC since this function can be
> > called with interrupts disabled.
> > 
> > Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> > ---
> >  arch/powerpc/sysdev/fsl_pci.c | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> > index 6455c1e..635d743 100644
> > --- a/arch/powerpc/sysdev/fsl_pci.c
> > +++ b/arch/powerpc/sysdev/fsl_pci.c
> > @@ -69,11 +69,13 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
> >  
> >  	if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
> >  		if (hose->ops->read == fsl_indirect_read_config) {
> > -			struct pci_bus bus;
> > -			bus.number = hose->first_busno;
> > -			bus.sysdata = hose;
> > -			bus.ops = hose->ops;
> > -			indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
> > +			struct pci_bus *bus;
> > +			bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
> > +			bus->number = hose->first_busno;
> 
> Missing check for allocation failure.

thanks.

> Do we not have a real struct pci_bus we can use here?  Or refactor
> indirect_read_config() to take hose and bus number instead?

indirect_read_config() can't be refactored because it is also used
in the generic struct pci_ops.  Unless you mean making an
__indirect_read_config that the original would call, but that
doesn't look that trivial given it calls pci_exclude_device with a
struct pci_controller hose.

> If putting a pci_bus struct on the stack is no longer OK, then
> fake_pci_bus() should be fixed as well.  I wonder if GCC is allocating
> separate pci_bus structs on the stack for this one and the one that
> early_read_config_dword() uses...

fake_pci_bus()' version is static, so it's not on the stack.

given that, maybe fsl_pcie_check_link()'s should be static too?

Kim

  reply	other threads:[~2015-01-22  2:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 20:03 [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN Kim Phillips
2015-01-21  0:31 ` Scott Wood
2015-01-22  2:48   ` Kim Phillips [this message]
2015-01-22  3:02     ` Scott Wood
2015-01-23  0:20       ` Kim Phillips
2015-01-23  0:43         ` Scott Wood
2015-01-23  1:05           ` [PATCH v2] " Kim Phillips

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150121204844.fda3d4ab23a8226b6cdfdaf6@freescale.com \
    --to=kim.phillips@freescale.com \
    --cc=anton@samba.org \
    --cc=asierra@xes-inc.com \
    --cc=dongsheng.wang@freescale.com \
    --cc=himangi774@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).