linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe()
@ 2017-12-01 20:26 Alexey Khoroshilov
  2017-12-02  1:21 ` Moritz Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Khoroshilov @ 2017-12-01 20:26 UTC (permalink / raw)
  To: Alan Tull, Moritz Fischer
  Cc: Alexey Khoroshilov, linux-fpga, linux-kernel, ldv-project

If fpga_mgr_register() fails, a clock is left undisabled.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/fpga/socfpga-a10.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c
index f8770af0f6b5..a46e343a5b72 100644
--- a/drivers/fpga/socfpga-a10.c
+++ b/drivers/fpga/socfpga-a10.c
@@ -519,8 +519,14 @@ static int socfpga_a10_fpga_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	return fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
+	ret = fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
 				 &socfpga_a10_fpga_mgr_ops, priv);
+	if (ret) {
+		clk_disable_unprepare(priv->clk);
+		return ret;
+	}
+
+	return 0;
 }
 
 static int socfpga_a10_fpga_remove(struct platform_device *pdev)
-- 
2.7.4

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

* Re: [PATCH] fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe()
  2017-12-01 20:26 [PATCH] fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe() Alexey Khoroshilov
@ 2017-12-02  1:21 ` Moritz Fischer
  2017-12-04 15:44   ` Alan Tull
  0 siblings, 1 reply; 4+ messages in thread
From: Moritz Fischer @ 2017-12-02  1:21 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Alan Tull, Moritz Fischer, linux-fpga, linux-kernel, ldv-project

Hi Alexey,

On Fri, Dec 01, 2017 at 11:26:24PM +0300, Alexey Khoroshilov wrote:
> If fpga_mgr_register() fails, a clock is left undisabled.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/fpga/socfpga-a10.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c
> index f8770af0f6b5..a46e343a5b72 100644
> --- a/drivers/fpga/socfpga-a10.c
> +++ b/drivers/fpga/socfpga-a10.c
> @@ -519,8 +519,14 @@ static int socfpga_a10_fpga_probe(struct platform_device *pdev)
>  		return -EBUSY;
>  	}
>  
> -	return fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
> +	ret = fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
>  				 &socfpga_a10_fpga_mgr_ops, priv);
> +	if (ret) {
> +		clk_disable_unprepare(priv->clk);
> +		return ret;
> +	}
> +
> +	return 0;
>  }
>  
>  static int socfpga_a10_fpga_remove(struct platform_device *pdev)
> -- 
> 2.7.4
> 
> --
> 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 for your patch,

Moritz

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

* Re: [PATCH] fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe()
  2017-12-02  1:21 ` Moritz Fischer
@ 2017-12-04 15:44   ` Alan Tull
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Tull @ 2017-12-04 15:44 UTC (permalink / raw)
  To: Moritz Fischer; +Cc: Alexey Khoroshilov, linux-fpga, linux-kernel, ldv-project

On Fri, Dec 1, 2017 at 7:21 PM, Moritz Fischer <mdf@kernel.org> wrote:

Hi Alexey,

Thanks for the fix!

Alan

> Hi Alexey,
>
> On Fri, Dec 01, 2017 at 11:26:24PM +0300, Alexey Khoroshilov wrote:
>> If fpga_mgr_register() fails, a clock is left undisabled.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
>>
>> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Reviewed-by: Moritz Fischer <mdf@kernel.org>

Acked-by: Alan Tull <atull@kernel.org>

>> ---
>>  drivers/fpga/socfpga-a10.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c
>> index f8770af0f6b5..a46e343a5b72 100644
>> --- a/drivers/fpga/socfpga-a10.c
>> +++ b/drivers/fpga/socfpga-a10.c
>> @@ -519,8 +519,14 @@ static int socfpga_a10_fpga_probe(struct platform_device *pdev)
>>               return -EBUSY;
>>       }
>>
>> -     return fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
>> +     ret = fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
>>                                &socfpga_a10_fpga_mgr_ops, priv);
>> +     if (ret) {
>> +             clk_disable_unprepare(priv->clk);
>> +             return ret;
>> +     }
>> +
>> +     return 0;
>>  }
>>
>>  static int socfpga_a10_fpga_remove(struct platform_device *pdev)
>> --
>> 2.7.4
>>
>> --
>> 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 for your patch,
>
> Moritz

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

* [PATCH] fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe()
  2017-12-08 17:36 [PATCH] patch for FPGA Alan Tull
@ 2017-12-08 17:37 ` Alan Tull
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Tull @ 2017-12-08 17:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Moritz Fischer, Alan Tull, linux-kernel, linux-fpga, Alexey Khoroshilov

From: Alexey Khoroshilov <khoroshilov@ispras.ru>

If fpga_mgr_register() fails, a clock is left undisabled.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alan Tull <atull@kernel.org>
---
 drivers/fpga/socfpga-a10.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c
index f8770af..a46e343 100644
--- a/drivers/fpga/socfpga-a10.c
+++ b/drivers/fpga/socfpga-a10.c
@@ -519,8 +519,14 @@ static int socfpga_a10_fpga_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	return fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
+	ret = fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager",
 				 &socfpga_a10_fpga_mgr_ops, priv);
+	if (ret) {
+		clk_disable_unprepare(priv->clk);
+		return ret;
+	}
+
+	return 0;
 }
 
 static int socfpga_a10_fpga_remove(struct platform_device *pdev)
-- 
2.7.4

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

end of thread, other threads:[~2017-12-08 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 20:26 [PATCH] fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe() Alexey Khoroshilov
2017-12-02  1:21 ` Moritz Fischer
2017-12-04 15:44   ` Alan Tull
2017-12-08 17:36 [PATCH] patch for FPGA Alan Tull
2017-12-08 17:37 ` [PATCH] fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe() 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).