lkml.org 
[lkml]   [2015]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v11 3/4] add FPGA manager core
On Wed, 23 Sep 2015, Dan Carpenter wrote:

> On Wed, Sep 23, 2015 at 03:23:54PM +0200, Pavel Machek wrote:
> > > > +int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
> > > > + const char *image_name)
> > > > +{
> > > > + struct device *dev = &mgr->dev;
> > > > + const struct firmware *fw;
> > > > + int ret;
> > > > +
> > > > + if (!mgr)
> > > > + return -ENODEV;
> > >
> > > Again; I'm of the opinion this is needlessly defensive.
> >
> > Not only that, it can never happen. mgr is already dereferenced above.
> >
>
> It's not dereferenced. We're taking the address of mgr->dev but we
> don't dereference mgr.
>
> regards,
> dan carpenter
>
>

That's correct, it's not dereferenced.

Is there some community agreement on whether we want to check a pointer
that has been passed for NULL or not? This is C code after all. Checking
a passed pointer for NULL is a very common reason to return -ENODEV.

Alan


\
 
 \ /
  Last update: 2015-09-23 18:41    [W:0.057 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site