From patchwork Mon Aug 18 16:56:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 35532 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CAA3520523 for ; Mon, 18 Aug 2014 16:57:42 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id 9sf18127931ykp.7 for ; Mon, 18 Aug 2014 09:57:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=7xws4GC+wfWYClqUedcRUspltwM24aGtKeDvurAcFVc=; b=D8BksfUNsdu/4LGzYoxU3dltl5Tc7pJUB1LRPuXdvs5z4+8j4WLCo+uFQ5TT+PNc5d Ny8oDUy71VAbGbaZkY/XjzcmoNJ+d56nL2tKGA/r3y/n6CVaQaLAsoPP32xvl8J+XaIU Gi7eJ55zingInq4ofgHy22vDmWjc783CTWOBOIUeA5W6m1fKPyTBvBXsiM6g65rauO1e zkCSNwwZpOjmlZJvwz5ayChDVXadcrV1NiU+PzoF/aop+KmCcDRjMBg7/ui+6hf6k3by dAekn2Qkt0SEFKSs9MdJEfjrx7Q/JVPl4NJG0u2FIKeb1ez4k27fOhxQ3qz/h7CBK1KH Ek/Q== X-Gm-Message-State: ALoCoQnWXfgogLLLc8CVoXjeUoMyboPck5q8eibLxtl1GcrnrU87mfq89YM7KWDJ2o3NFnBOs7wF X-Received: by 10.236.126.103 with SMTP id a67mr16054911yhi.4.1408381062664; Mon, 18 Aug 2014 09:57:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.141 with SMTP id s13ls2347976qga.6.gmail; Mon, 18 Aug 2014 09:57:42 -0700 (PDT) X-Received: by 10.52.240.169 with SMTP id wb9mr818860vdc.81.1408381062496; Mon, 18 Aug 2014 09:57:42 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id h6si7336834vdw.73.2014.08.18.09.57.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Aug 2014 09:57:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so5962625vcb.26 for ; Mon, 18 Aug 2014 09:57:42 -0700 (PDT) X-Received: by 10.52.119.229 with SMTP id kx5mr5527433vdb.40.1408381062401; Mon, 18 Aug 2014 09:57:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp168402vcb; Mon, 18 Aug 2014 09:57:41 -0700 (PDT) X-Received: by 10.66.196.131 with SMTP id im3mr35864147pac.21.1408381061401; Mon, 18 Aug 2014 09:57:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id uj2si22586190pbc.60.2014.08.18.09.57.32 for ; Mon, 18 Aug 2014 09:57:33 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbaHRQ5X (ORCPT + 23 others); Mon, 18 Aug 2014 12:57:23 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:56616 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751671AbaHRQ5U (ORCPT ); Mon, 18 Aug 2014 12:57:20 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s7IGuuYQ006692; Mon, 18 Aug 2014 11:56:56 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7IGuuSA021558; Mon, 18 Aug 2014 11:56:56 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Mon, 18 Aug 2014 11:56:56 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7IGuu4m019681; Mon, 18 Aug 2014 11:56:56 -0500 From: Nishanth Menon To: Tero Kristo , Mike Turquette CC: , , , Nishanth Menon Subject: [PATCH 2/2] clk: ti: dra7-atl: Provide error check for incoming parameters in set_rate Date: Mon, 18 Aug 2014 11:56:55 -0500 Message-ID: <1408381015-16042-3-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1408381015-16042-1-git-send-email-nm@ti.com> References: <1408381015-16042-1-git-send-email-nm@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nm@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Check for valid parameters in check rate. Else, we end up getting errors. This occurs as part of the inital clock tree update of child clock nodes where new_rate could be 0 for non functional clocks. Fixes: 9ac33b0ce81fa48 (" CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)") Signed-off-by: Nishanth Menon --- drivers/clk/ti/clk-dra7-atl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index 4a65b41..af29359 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -139,9 +139,13 @@ static long atl_clk_round_rate(struct clk_hw *hw, unsigned long rate, static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { - struct dra7_atl_desc *cdesc = to_atl_desc(hw); + struct dra7_atl_desc *cdesc; u32 divider; + if (!hw || !rate) + return -EINVAL; + + cdesc = to_atl_desc(hw); divider = ((parent_rate + rate / 2) / rate) - 1; if (divider > DRA7_ATL_DIVIDER_MASK) divider = DRA7_ATL_DIVIDER_MASK;