linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: altera-cvp: Fix an error handling path in 'altera_cvp_probe()'
@ 2018-06-11 17:20 Christophe JAILLET
  2018-06-13 12:42 ` Moritz Fischer
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2018-06-11 17:20 UTC (permalink / raw)
  To: atull, mdf; +Cc: linux-fpga, linux-kernel, kernel-janitors, Christophe JAILLET

If 'fpga_mgr_create()' fails, we should release some resources, as done
in the other error handling path of the function.

Fixes: 7085e2a94f7d ("fpga: manager: change api, don't use drvdata")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/fpga/altera-cvp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index dd4edd8f22ce..7fa793672a7a 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -455,8 +455,10 @@ static int altera_cvp_probe(struct pci_dev *pdev,
 
 	mgr = fpga_mgr_create(&pdev->dev, conf->mgr_name,
 			      &altera_cvp_ops, conf);
-	if (!mgr)
-		return -ENOMEM;
+	if (!mgr) {
+		ret = -ENOMEM;
+		goto err_unmap;
+	}
 
 	pci_set_drvdata(pdev, mgr);
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fpga: altera-cvp: Fix an error handling path in 'altera_cvp_probe()'
  2018-06-11 17:20 [PATCH] fpga: altera-cvp: Fix an error handling path in 'altera_cvp_probe()' Christophe JAILLET
@ 2018-06-13 12:42 ` Moritz Fischer
  2018-06-13 14:27   ` Alan Tull
  0 siblings, 1 reply; 3+ messages in thread
From: Moritz Fischer @ 2018-06-13 12:42 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Alan Tull, linux-fpga, Linux Kernel Mailing List, kernel-janitors

Hi Christophe,

good catch!

On Mon, Jun 11, 2018 at 12:20 PM, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
> If 'fpga_mgr_create()' fails, we should release some resources, as done
> in the other error handling path of the function.
>
> Fixes: 7085e2a94f7d ("fpga: manager: change api, don't use drvdata")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/fpga/altera-cvp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
> index dd4edd8f22ce..7fa793672a7a 100644
> --- a/drivers/fpga/altera-cvp.c
> +++ b/drivers/fpga/altera-cvp.c
> @@ -455,8 +455,10 @@ static int altera_cvp_probe(struct pci_dev *pdev,
>
>         mgr = fpga_mgr_create(&pdev->dev, conf->mgr_name,
>                               &altera_cvp_ops, conf);
> -       if (!mgr)
> -               return -ENOMEM;
> +       if (!mgr) {
> +               ret = -ENOMEM;
> +               goto err_unmap;
> +       }
>
>         pci_set_drvdata(pdev, mgr);
>
> --
> 2.17.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fpga" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks,

Moritz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fpga: altera-cvp: Fix an error handling path in 'altera_cvp_probe()'
  2018-06-13 12:42 ` Moritz Fischer
@ 2018-06-13 14:27   ` Alan Tull
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Tull @ 2018-06-13 14:27 UTC (permalink / raw)
  To: Moritz Fischer
  Cc: Christophe JAILLET, linux-fpga, Linux Kernel Mailing List,
	kernel-janitors

On Wed, Jun 13, 2018 at 7:42 AM, Moritz Fischer
<moritz.fischer@ettus.com> wrote:
> Hi Christophe,
>
> good catch!

Yes, thanks!

>
> On Mon, Jun 11, 2018 at 12:20 PM, Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>> If 'fpga_mgr_create()' fails, we should release some resources, as done
>> in the other error handling path of the function.
>>
>> Fixes: 7085e2a94f7d ("fpga: manager: change api, don't use drvdata")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Reviewed-by: Moritz Fischer <mdf@kernel.org>
Acked-by: Alan Tull <atull@kernel.org>

>> ---
>>  drivers/fpga/altera-cvp.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
>> index dd4edd8f22ce..7fa793672a7a 100644
>> --- a/drivers/fpga/altera-cvp.c
>> +++ b/drivers/fpga/altera-cvp.c
>> @@ -455,8 +455,10 @@ static int altera_cvp_probe(struct pci_dev *pdev,
>>
>>         mgr = fpga_mgr_create(&pdev->dev, conf->mgr_name,
>>                               &altera_cvp_ops, conf);
>> -       if (!mgr)
>> -               return -ENOMEM;
>> +       if (!mgr) {
>> +               ret = -ENOMEM;
>> +               goto err_unmap;
>> +       }
>>
>>         pci_set_drvdata(pdev, mgr);
>>
>> --
>> 2.17.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-fpga" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> Thanks,
>
> Moritz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-13 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 17:20 [PATCH] fpga: altera-cvp: Fix an error handling path in 'altera_cvp_probe()' Christophe JAILLET
2018-06-13 12:42 ` Moritz Fischer
2018-06-13 14:27   ` Alan Tull

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).