On Tue, Jun 12, 2012 at 07:01:19PM -0700, John Stultz wrote:Hrm. That's a good trick to remember for the future!diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.cOptionally you could just:
index 36d20bd..bd295e8 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -362,13 +362,12 @@ static int __devinit etb_probe(struct amba_device *dev, const struct amba_id *id
if (ret)
goto out_unmap;
+ /* Get optional clock. Currently used to select clock source on omap3 */
t->emu_clk = clk_get(&dev->dev, "emu_src_ck");
- if (IS_ERR(t->emu_clk)) {
+ if (IS_ERR(t->emu_clk))
dev_dbg(&dev->dev, "Failed to obtain emu_src_ck.\n");
- return -EFAULT;
- }
-
- clk_enable(t->emu_clk);
+ else
+ clk_enable(t->emu_clk);
if (IS_ERR(t->emu_clk))
t->emu_clk = NULL;
and use the clk API as you were, as it does handle NULL being passed in.
In this case you don't have too many callsites to worry about, but it's
reasonably convenient to be able to pass a NULL clk pointer around
without constant special-casing when those start to balloon up.