Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5560965imm; Sat, 19 May 2018 04:55:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquctiCeE2B6ayVCRlhuXM9VMAMd8KyVwXBoGBOUkug2PEeC2QCgA0AX1IvMK6o3d5aD7dy X-Received: by 2002:a65:414c:: with SMTP id x12-v6mr10401634pgp.70.1526730930295; Sat, 19 May 2018 04:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526730930; cv=none; d=google.com; s=arc-20160816; b=uwClY/UQEseXlt9p+UKvoBUI54EoOgNiRZBQ08tQA9HMJrOxKmgFYLQdxnqV00G9IP VzWRjydEAoIcWY5jsufAxXYQRDHuyLkLXoXLZixnn6y3l3dd7HPFOaUIj1azvZ/sD1MW dShqB78V3/YyaN3B0dWZvZc4PBNuwK6pmrkgKdNE04SKcawkf2Fhj0aySp0GY6hcmuGq rcarys6ZXjH55IhjKTLo1Xt5OPZStDjM3o10HEjifViIolFezz2BJLgO1xlkWBo1GW68 OYE6uY6zqNUfvCoVs/JELPs3mPyPuoUuoShChzqVZJOh+ivqdfjaSgEecd57AJCWrJzA YhEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ZLdnannZHxYyY9t/I5w6z0cLft5Qcj8S1xaLSp0/g4Q=; b=IsecOnkFErVfDmxUwnHyhXEp6mq0z6qMfMqefLNky9D7CiAjZNY9gzVJf8bNLPL9uN +wajkuFV17+x50B1CXgYUqHKHlSAps/Ih0ppYdnJIprZn6PugZJU/CMtrlP6meiEYDkx 8sO5ohsdtr5BXGwaGHC31T1XmpO+EHLuaamIWJ+u299dLBe8EOGOGoYlIkoXxwBbQPBG TfdySjZmvDnslPVRMn7VCTW9BVKQhEl18OJDN7/59IDHdlfSDlfjGGhpstkuGW1TiK96 rJMJyogYevfcmBVEhoGVoFE6aJHwDeGNikOA70ymBpZTnjnsu8sh5qTBzugL9wmsMjh4 5yyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=LuBLg0bS; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e37-v6si9782878plb.400.2018.05.19.04.55.15; Sat, 19 May 2018 04:55:30 -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=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=LuBLg0bS; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752210AbeESLzE (ORCPT + 99 others); Sat, 19 May 2018 07:55:04 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:35626 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751994AbeESLzA (ORCPT ); Sat, 19 May 2018 07:55:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZLdnannZHxYyY9t/I5w6z0cLft5Qcj8S1xaLSp0/g4Q=; b=LuBLg0bS+drQh59txZv/pARJJ J09sd4FBvmBDgsDrfAiso0N1WDz6O/odOE9DlyoEO8N/HAcS0k//GPW60CDzQd3oeQgfQzbi1Z2eC aroSv0e+DsECUJejiXzyFwaq01XCETwTfjkvPFth4q/FvxU0X3t7YsY0cucMTOtVcr4DU=; Received: from n2100.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:4f86]:44887) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1fK0Ri-0003Vl-3e; Sat, 19 May 2018 12:54:46 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1fK0Rf-00022X-A6; Sat, 19 May 2018 12:54:43 +0100 Date: Sat, 19 May 2018 12:54:41 +0100 From: Russell King - ARM Linux To: ilialin@codeaurora.org Cc: 'Viresh Kumar' , mark.rutland@arm.com, nm@ti.com, catalin.marinas@arm.com, mturquette@baylibre.com, will.deacon@arm.com, tfinkel@codeaurora.org, linux-kernel@vger.kernel.org, david.brown@linaro.org, nicolas.dechesne@linaro.org, linux-clk@vger.kernel.org, robh@kernel.org, andy.gross@linaro.org, celster@codeaurora.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, broonie@kernel.org, linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rnayak@codeaurora.org, sboyd@kernel.org, rjw@rjwysocki.net, lgirdwood@gmail.com, amit.kucheria@linaro.org Subject: Re: [PATCH v8 10/15] cpufreq: Add Kryo CPU scaling driver Message-ID: <20180519115441.GK17671@n2100.armlinux.org.uk> References: <1526555955-29960-1-git-send-email-ilialin@codeaurora.org> <1526555955-29960-11-git-send-email-ilialin@codeaurora.org> <20180518014538.duphof6enscpm5vp@vireshk-i7> <018701d3ef61$dfd5e700$9f81b500$@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <018701d3ef61$dfd5e700$9f81b500$@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 19, 2018 at 02:09:24PM +0300, ilialin@codeaurora.org wrote: > +static int __init qcom_cpufreq_kryo_driver_init(void) > +{ > + struct device *cpu_dev_silver, *cpu_dev_gold; > + struct opp_table *opp_silver, *opp_gold; > + enum _msm8996_version msm8996_version; > + struct nvmem_cell *speedbin_nvmem; > + struct platform_device *pdev; > + struct device_node *np; > + u8 *speedbin; > + u32 versions; > + size_t len; > + int ret; > + > + cpu_dev_silver = get_cpu_device(SILVER_LEAD); > + if (IS_ERR_OR_NULL(cpu_dev_silver)) > + return PTR_ERR(cpu_dev_silver); > + > + cpu_dev_gold = get_cpu_device(SILVER_LEAD); > + if (IS_ERR_OR_NULL(cpu_dev_gold)) > + return PTR_ERR(cpu_dev_gold); > + > + msm8996_version = qcom_cpufreq_kryo_get_msm_id(); > + if (NUM_OF_MSM8996_VERSIONS == msm8996_version) { > + dev_err(cpu_dev_silver, "Not Snapdragon 820/821!"); > + return -ENODEV; > + } > + > + np = dev_pm_opp_of_get_opp_desc_node(cpu_dev_silver); > + if (IS_ERR_OR_NULL(np)) > + return PTR_ERR(np); This function (qcom_cpufreq_kryo_driver_init) returns zero on success. You are checking "np" here for being an error pointer, or NULL. What value do you think PTR_ERR() returns in the case of PTR_ERR(NULL)? IS_ERR_OR_NULL() is considered by some (me included) as being _very_ harmful because programmers generally fail to look at linux/err.h and consider what it means when used as above. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up