linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Tull <atull@kernel.org>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Moritz Fischer <mdf@kernel.org>,
	linux-fpga@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fpga: fpga-mgr: remove unnecessary code in __fpga_mgr_get
Date: Fri, 27 Oct 2017 13:30:57 -0500	[thread overview]
Message-ID: <CANk1AXQX24U06SBuoBmw=UWeCdnu3OV4BW2ZRBW4t1KirZZ5DA@mail.gmail.com> (raw)
In-Reply-To: <20171026230230.GA4904@embeddedor.com>

On Thu, Oct 26, 2017 at 6:02 PM, Gustavo A. R. Silva
<garsilva@embeddedor.com> wrote:

Hi Gustavo,

Thanks for pointing that out.  There's also a similar thing in
fpga-bridge.c that I need to fix.

Alan

> Notice that mgr = to_fpga_manager(dev); expands to:
>
> mgr = container_of(dev, struct fpga_manager, dev);
>
> and container_of is never null, so this null check is
> unnecessary.
>
> Addresses-Coverity-ID: 1397916
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/fpga/fpga-mgr.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
> index 188ffef..33063ca 100644
> --- a/drivers/fpga/fpga-mgr.c
> +++ b/drivers/fpga/fpga-mgr.c
> @@ -367,8 +367,6 @@ static struct fpga_manager *__fpga_mgr_get(struct device *dev)
>         int ret = -ENODEV;
>
>         mgr = to_fpga_manager(dev);
> -       if (!mgr)
> -               goto err_dev;
>
>         /* Get exclusive use of fpga manager */
>         if (!mutex_trylock(&mgr->ref_mutex)) {
> --
> 2.7.4
>

  reply	other threads:[~2017-10-27 18:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26 23:02 [PATCH] fpga: fpga-mgr: remove unnecessary code in __fpga_mgr_get Gustavo A. R. Silva
2017-10-27 18:30 ` Alan Tull [this message]
2017-10-27 19:09   ` Gustavo A. R. Silva
2017-10-27 19:49     ` Alan Tull
2017-10-27 19:55       ` Gustavo A. R. Silva

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='CANk1AXQX24U06SBuoBmw=UWeCdnu3OV4BW2ZRBW4t1KirZZ5DA@mail.gmail.com' \
    --to=atull@kernel.org \
    --cc=garsilva@embeddedor.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    /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).