Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2056005imm; Wed, 16 May 2018 07:14:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr3yTW4URXcFNFXw/TnJFcbArBGeDesDdRucySj769/xts7E+4VPzRM2CMXIy3Gpj5tQYdd X-Received: by 2002:aa7:83c7:: with SMTP id j7-v6mr1182151pfn.50.1526480096993; Wed, 16 May 2018 07:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526480096; cv=none; d=google.com; s=arc-20160816; b=kCpqb8mtqsr9JWIG/mEV7QwhhPZYW4yYrJQe81+nzBY6MrOlI2SdXs0WjgttrTC0RC 7f8cZi+i4DiQCkfK5pL5jwBNSM2S5LABS0BHen3VckY6b+G5odUoAaREfy/5Gv0hy7PN KcvvV6oNpGVmRe8RWqmBC0eFna4rdf73Tr/bR3jrjrDTqSKRsN0WToCXdCM+KSHB/IHm +FpSrfReu69D1rdKc/Carm7I2AYTtkJiK3jjQIVfJym37K6LvZf91OwFU/NcOyQkfm3x jm6SwuXu1UTfPwAx3lQ6UvYsOvPYtAp8mQ+fnnryds0AMotzWqk0CbeASKzde6P/HSOe lIbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=0NHXrkDy9bB1AWybx3oxSuyglSDfrw0BvCNH1RJCBoA=; b=Vc4kC02YlofTMorz08NR7z/BQCPJSmhIKJOHUG4/9RBvSCuIH8+2nCt/h6COvd76L/ DJtFu3uE+/0ByTiswEvU4LdWXfQdafJFMppJot1Mp5h4IcRTeLO4T7EHyqTAwA883VH1 Rxw2LZGtrHOxj4TJLJ2ZQUJGcN68Uy8Xu9e4nvX8RlE/yhElUnY0IePtm1N72HCi4K7w bzBq6Z9QDF3io4mkuuwowKNPxK3K5+dZJDnE7vhVZw+ze09mr+1lxrpp5EeMrRafLKsm dPi8TueidQoJa63jIATilUAF4pIc7LeAc5n/VOz/vTbHjMifIz+pjq1YmWSG2NNf6Inn e2HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fY+S+Aco; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h193-v6si2154523pgc.57.2018.05.16.07.14.42; Wed, 16 May 2018 07:14:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fY+S+Aco; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752610AbeEPONu (ORCPT + 99 others); Wed, 16 May 2018 10:13:50 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:42126 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752510AbeEPONq (ORCPT ); Wed, 16 May 2018 10:13:46 -0400 Received: by mail-qt0-f193.google.com with SMTP id c2-v6so1186803qtn.9 for ; Wed, 16 May 2018 07:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0NHXrkDy9bB1AWybx3oxSuyglSDfrw0BvCNH1RJCBoA=; b=fY+S+Acowrai50Tg8hkVx/rMD8CtA1NFENiZdB+V2/DD13M4cSuR4eLQQkHPtYZIxu Rwk2ClZ8URmtkoqdQDc4LId3GpuTsnJ22qwQFotg1XqD/hhV12XBeF97NlOeDw6/sUdz OSNYJ8IGANIlKu/ToLQYA1ozXHvZBgOt3u6Jk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0NHXrkDy9bB1AWybx3oxSuyglSDfrw0BvCNH1RJCBoA=; b=JMk4EFkx8wQwfK7dE4IJk0SnoWmwI3KVfhDvgCFrETs+994otHfvlHUvsHRRO5wb2V /bb2gyMcIgCn+3Nm1C59VThgr8Twsb/rUujFuHlvfSi5uexJtnK9adydNyVel0J1NtyY ve/xJthFJZw8B6vcn1ckhrfgil6YF8TU2KAPsn8Nc+63TB2Wem6NMAvTAgHuJmJuSm+k mP7xS2AyLz8vNsXakFKkhU62nZ5N91LsuyXpLlehcQo82LQD/3QuUwCb4dATBkTxnRPc cndyAwTwTEoBwSBon4HFmye/NAeFIBFaLe+eH6cvOaTj3EPVScjOM6oxcEFed5Nio/fw aovg== X-Gm-Message-State: ALKqPweE7ihT2XZ6da+Z3vwP7gGnFUTB+HiOnGV4ywj5ghPRI7FIlVw+ hp+/d9GRCmS5M9SMTMzgCUpG5JQPMHg9OuvMBsQVig== X-Received: by 2002:a0c:989b:: with SMTP id f27-v6mr1027512qvd.115.1526480025748; Wed, 16 May 2018 07:13:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:2990:0:0:0:0:0 with HTTP; Wed, 16 May 2018 07:13:44 -0700 (PDT) In-Reply-To: <20180516141132.aqjif7d5motmmnlo@vireshk-i7> References: <1526375616-16904-1-git-send-email-ilialin@codeaurora.org> <1526375616-16904-13-git-send-email-ilialin@codeaurora.org> <20180516141132.aqjif7d5motmmnlo@vireshk-i7> From: Amit Kucheria Date: Wed, 16 May 2018 17:13:44 +0300 Message-ID: Subject: Re: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver To: Viresh Kumar Cc: Ilia Lin , Michael Turquette , sboyd@kernel.org, Rob Herring , Mark Rutland , "Menon, Nishanth" , lgirdwood@gmail.com, Mark Brown , Andy Gross , David Brown , Catalin Marinas , Will Deacon , "Rafael J. Wysocki" , linux-clk@vger.kernel.org, DTML , LKML , Linux PM list , linux-arm-msm , "open list:ARM/QUALCOMM SUPPORT" , lakml , Rajendra Nayak , Nicolas Dechesne , celster@codeaurora.org, tfinkel@codeaurora.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 16, 2018 at 5:11 PM, Viresh Kumar wrote: > On 16-05-18, 16:12, Amit Kucheria wrote: >> > + ret = PTR_ERR_OR_ZERO(opp_temp = >> > + dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); >> > + if (0 > ret) >> >> Any particular reason to prefer this over (ret < 0) that is generally >> used? I've seen it used to avoid the == vs. = typos, but not for other >> comparisons. >> >> Suggest sticking to what is commonly used i.e. ret < 0. >> >> > + goto free_opp; >> > + >> > + cpu_dev = get_cpu_device(GOLD_LEAD); >> >> Error check cpu_dev here? >> >> > + ret = PTR_ERR_OR_ZERO(opp_temp = >> > + dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); >> > + if (0 > ret) >> > + goto free_opp; > > The goto here is wrong > >> > + >> > + >> > + ret = PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", >> > + -1, NULL, 0)); >> > + >> > + if (0 == ret) >> > + return 0; >> > + >> > +free_opp: >> > + dev_pm_opp_put_supported_hw(opp_temp); >> >> This is not needed because dev_pm_opp_set_supported_hw will free >> memory in case of failure. This call in only needed in case of a >> successful get. > > But this is still required for the case where platform device > registration fails. Agreed. The overall error path needs to be re-written with proper check of return values.