Hi, On Sat, Sep 13, 2014 at 01:55:50AM +0530, Pramod Gurav wrote: > >>> + qdwc = devm_kzalloc(&pdev->dev, sizeof(*qdwc), GFP_KERNEL); > >>> + if (!qdwc) > >>> + return -ENOMEM; > >>> + > >>> + platform_set_drvdata(pdev, qdwc); > >>> + > >>> + qdwc->dev = &pdev->dev; > >>> + > >>> + qdwc->core_clk = devm_clk_get(qdwc->dev, "core"); > >>> + if (IS_ERR(qdwc->core_clk)) { > >>> + dev_err(qdwc->dev, "failed to get core clock\n"); > >>> + return PTR_ERR(qdwc->core_clk); > >>> + } > >>> + > >>> + qdwc->iface_clk = devm_clk_get(qdwc->dev, "iface"); > >>> + if (IS_ERR(qdwc->iface_clk)) { > >>> + dev_dbg(qdwc->dev, "failed to get optional iface clock\n"); > >>> + qdwc->iface_clk = NULL; > >>> + } > >>> + > >>> + qdwc->sleep_clk = devm_clk_get(qdwc->dev, "sleep"); > >>> + if (IS_ERR(qdwc->sleep_clk)) { > >>> + dev_dbg(qdwc->dev, "failed to get optional sleep clock\n"); > >>> + qdwc->sleep_clk = NULL; > >>> + } > >>> + > >>> + ret = clk_prepare_enable(qdwc->core_clk); > >>> + if (ret) { > >>> + dev_err(qdwc->dev, "failed to enable core clock\n"); > >>> + goto err_core; > >>> + } > >>> + > >>> + ret = clk_prepare_enable(qdwc->iface_clk); > >>> > >> Should not we check if qdwc->iface_clk is valid? > > > > read the sources luke. > Now I read that its initialized to NULL in fail case but should we call > prepare_enable at all if its NULL? now read the source of clk_enable() and clk_prepare() ;-) NULL is a valid clock, it just returns 0. This is better than sprinkling IS_ERR() all over the place. -- balbi
Attachment:
signature.asc
Description: Digital signature