lkml.org 
[lkml]   [2017]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] fpga: fpga-mgr: remove unnecessary code in __fpga_mgr_get
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
>

\
 
 \ /
  Last update: 2017-10-28 20:19    [W:0.060 / U:2.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site