Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1231434

Re: [PATCH v11 3/4] add FPGA manager core

From Pavel Machek <pavel@denx.de>
Newsgroups linux.kernel
Subject Re: [PATCH v11 3/4] add FPGA manager core
Date 2015-09-23 15:30 +0200
Message-ID <qbShr-5pG-1@gated-at.bofh.it> (permalink)
References <qbEoa-26P-25@gated-at.bofh.it> <qbEoa-26P-27@gated-at.bofh.it> <qbEoa-26P-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi!

> > +++ b/drivers/fpga/fpga-mgr.c
> > @@ -0,0 +1,382 @@
> [..]
> > +int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags, const char *buf,
> > +		      size_t count)
> > +{
> > +	struct device *dev = &mgr->dev;
> > +	int ret;
> > +
> > +	if (!mgr)
> > +		return -ENODEV;
> 
> This seems overly defensive.
> 
> [..]
> > +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.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v11 3/4] add FPGA manager core Josh Cartwright <joshc@ni.com> - 2015-09-23 00:40 +0200
  Re: [PATCH v11 3/4] add FPGA manager core Pavel Machek <pavel@denx.de> - 2015-09-23 15:30 +0200
    Re: [PATCH v11 3/4] add FPGA manager core Dan Carpenter <dan.carpenter@oracle.com> - 2015-09-23 16:20 +0200
      Re: [PATCH v11 3/4] add FPGA manager core Dan Carpenter <dan.carpenter@oracle.com> - 2015-09-24 10:00 +0200
        Re: [PATCH v11 3/4] add FPGA manager core Pavel Machek <pavel@denx.de> - 2015-09-24 23:20 +0200
        Re: [PATCH v11 3/4] add FPGA manager core Dan Carpenter <dan.carpenter@oracle.com> - 2015-09-25 12:10 +0200
  Re: [PATCH v11 3/4] add FPGA manager core Josh Cartwright <joshc@ni.com> - 2015-09-24 01:10 +0200

csiph-web