linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch V2] soc/tegra: fuse: Add fuse clock check in tegra_fuse_readl
@ 2019-09-03 10:56 Nagarjuna Kristam
  2019-09-19  8:40 ` Thierry Reding
  2019-10-01 15:04 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: Nagarjuna Kristam @ 2019-09-03 10:56 UTC (permalink / raw)
  To: thierry.reding, jonathanh; +Cc: linux-tegra, linux-kernel, Nagarjuna Kristam

tegra_fuse_readl() can be called from drivers at any time. If this API is
called before tegra_fuse_probe(), we end up enabling clock before it is
registered. Add check for fuse clock in tegra_fuse_readl() and return
corresponding error if any.

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
---
V2:
	- Added Null and other error checks for fuse->clk.
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 3eb44e6..58996c6 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -186,9 +186,12 @@ u32 __init tegra_fuse_read_early(unsigned int offset)
 
 int tegra_fuse_readl(unsigned long offset, u32 *value)
 {
-	if (!fuse->read)
+	if (!fuse->read || !fuse->clk)
 		return -EPROBE_DEFER;
 
+	if (IS_ERR(fuse->clk))
+		return PTR_ERR(fuse->clk);
+
 	*value = fuse->read(fuse, offset);
 
 	return 0;
-- 
2.7.4


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

* Re: [Patch V2] soc/tegra: fuse: Add fuse clock check in tegra_fuse_readl
  2019-09-03 10:56 [Patch V2] soc/tegra: fuse: Add fuse clock check in tegra_fuse_readl Nagarjuna Kristam
@ 2019-09-19  8:40 ` Thierry Reding
  2019-10-01 15:04 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2019-09-19  8:40 UTC (permalink / raw)
  To: Nagarjuna Kristam; +Cc: jonathanh, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

On Tue, Sep 03, 2019 at 04:26:52PM +0530, Nagarjuna Kristam wrote:
> tegra_fuse_readl() can be called from drivers at any time. If this API is
> called before tegra_fuse_probe(), we end up enabling clock before it is
> registered. Add check for fuse clock in tegra_fuse_readl() and return
> corresponding error if any.
> 
> Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
> ---
> V2:
> 	- Added Null and other error checks for fuse->clk.
> ---
>  drivers/soc/tegra/fuse/fuse-tegra.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Hi ARM-SoC maintainers,

can you pick this up as a bugfix for v5.4-rc1? Would you prefer to pick
it up directly or do you want a pull request for this?

The patchwork link is:

	http://patchwork.ozlabs.org/patch/1156928/

And in that case:

Acked-by: Thierry Reding <treding@nvidia.com>

Thanks,
Thierry

> diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
> index 3eb44e6..58996c6 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
> @@ -186,9 +186,12 @@ u32 __init tegra_fuse_read_early(unsigned int offset)
>  
>  int tegra_fuse_readl(unsigned long offset, u32 *value)
>  {
> -	if (!fuse->read)
> +	if (!fuse->read || !fuse->clk)
>  		return -EPROBE_DEFER;
>  
> +	if (IS_ERR(fuse->clk))
> +		return PTR_ERR(fuse->clk);
> +
>  	*value = fuse->read(fuse, offset);
>  
>  	return 0;
> -- 
> 2.7.4
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Patch V2] soc/tegra: fuse: Add fuse clock check in tegra_fuse_readl
  2019-09-03 10:56 [Patch V2] soc/tegra: fuse: Add fuse clock check in tegra_fuse_readl Nagarjuna Kristam
  2019-09-19  8:40 ` Thierry Reding
@ 2019-10-01 15:04 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2019-10-01 15:04 UTC (permalink / raw)
  To: Nagarjuna Kristam; +Cc: jonathanh, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

On Tue, Sep 03, 2019 at 04:26:52PM +0530, Nagarjuna Kristam wrote:
> tegra_fuse_readl() can be called from drivers at any time. If this API is
> called before tegra_fuse_probe(), we end up enabling clock before it is
> registered. Add check for fuse clock in tegra_fuse_readl() and return
> corresponding error if any.
> 
> Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
> ---
> V2:
> 	- Added Null and other error checks for fuse->clk.
> ---
>  drivers/soc/tegra/fuse/fuse-tegra.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Applied to for-5.5/soc, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-10-01 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 10:56 [Patch V2] soc/tegra: fuse: Add fuse clock check in tegra_fuse_readl Nagarjuna Kristam
2019-09-19  8:40 ` Thierry Reding
2019-10-01 15:04 ` Thierry Reding

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