Re: [v1 PATCH 3/8] EDAC: AMD8111 driver source file

From: Andrew Morton
Date: Wed Mar 11 2009 - 15:10:34 EST


On Wed, 11 Mar 2009 11:55:36 -0700 (PDT)
Doug Thompson <norsk5@xxxxxxxxx> wrote:

>
> --- On Tue, 3/10/09, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> > From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > Subject: Re: [v1 PATCH 3/8] EDAC: AMD8111 driver source file
> > To: "Harry Ciao" <qingtao.cao@xxxxxxxxxxxxx>
> > Cc: linux-kernel@xxxxxxxxxxxxxxx, bluesmoke-devel@xxxxxxxxxxxxxxxxxxxxx
> > Date: Tuesday, March 10, 2009, 2:46 PM
> > On Mon,__ 9 Mar 2009 16:08:12
> > +0800
> > Harry Ciao <qingtao.cao@xxxxxxxxxxxxx>
> > wrote:
>
> <snip>
>
> > > +static void edac_pci_write_dword(struct pci_dev *dev,
> > int reg, u32 val32)
> > > +{
> > > +______ int ret;
> > > +
> > > +______ ret = pci_write_config_dword(dev,
> > reg, val32);
> > > +______ if (ret > 0)
> > > +______ ______ printk(KERN_ERR
> > AMD8111_EDAC_MOD_STR
> > > +______ ______
> > ______ " PCI Access Write Error at 0x%x\n",
> > reg);
> > > +}
> > > +
> > > +static void edac_pci_write_byte(struct pci_dev *dev,
> > int reg, u8 val8)
> > > +{
> > > +______ int ret;
> > > +
> > > +______ ret = pci_write_config_byte(dev,
> > reg, val8);
> > > +______ if (ret > 0)
> > > +______ ______ printk(KERN_ERR
> > AMD8111_EDAC_MOD_STR
> > > +______ ______
> > ______ " PCI Access Write Error at 0x%x\n",
> > reg);
> > > +}
> >
> >
> > <spends a while trying to work out what the return value
> > of
> > pci_read_config_dword() means>
> >
> > <gets frustrated and gives up>
> >
> > Is it correct that all of these functions treat a +ve
> > return value as
> > an error?
>
> Yes, the config APIs do return an error code on an operation error.

OK, but presumably they're negative error codes, so

if (ret > 0)
error()

isn't right.

<checks>

Harry has turned that into

if (ret != 0)
error();

which looks better.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/