Re: [PATCH 03/12] edac: edac_mc.c: Use an error code instead of -1

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

 



Em Fri, 28 Oct 2016 15:50:58 +0200
Borislav Petkov <bp@xxxxxxxxx> escreveu:

> On Wed, Oct 26, 2016 at 05:58:53PM -0200, Mauro Carvalho Chehab wrote:
> > If a csrow is not found by edac_mc_find_csrow_by_page(), it
> > currently returns -1, to mean that the page is invalid. Use
> > the proper errorcode macro for that (-EINVAL).
> > 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx>
> > ---
> >  drivers/edac/edac_mc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
> > index c3ee3ad98a63..0438d3a48191 100644
> > --- a/drivers/edac/edac_mc.c
> > +++ b/drivers/edac/edac_mc.c  
> 
> There's a
> 
> /* FIXME - should return -1 */
> 
> which can go too.
> 
> > @@ -845,7 +845,7 @@ int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, unsigned long page)
> >  	int row, i, j, n;
> >  
> >  	edac_dbg(1, "MC%d: 0x%lx\n", mci->mc_idx, page);
> > -	row = -1;
> > +	row = -EINVAL;  
> 
> This breaks at least i82975x_process_error_info() which checks for row
> being -1.
> 
> And its output gets fed into edac_mc_handle_error() which uses -1 to
> denote N/A for some layers.
> 
> IOW, so what if it returns -1?
> 
> The only thing that needs fixing is removing that FIXME above it.

It is non-standard to return -1 instead of an error code. This
is the only function at the EDAC kAPI that does that.

Ok, we could document it at the edac_core.h, but IMHO, it is
better to have it fixed.


Thanks,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux