Skip to content

Commit

Permalink
soc/tegra: fuse: Add FUSE clock check in tegra_fuse_readl()
Browse files Browse the repository at this point in the history
tegra_fuse_readl() can be called from drivers at any time. If this API
is called before tegra_fuse_probe(), we end up enabling the clock before
it is registered. Add a check for the FUSE clock in tegra_fuse_readl()
and propagate any errors.

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Nagarjuna Kristam authored and Thierry Reding committed Oct 1, 2019
1 parent 54ecb8f commit 0a728e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/soc/tegra/fuse/fuse-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0a728e0

Please sign in to comment.