From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Hunter Subject: Re: [PATCH] PM / OPP: Initialize regulator pointer to an error value Date: Mon, 15 Feb 2016 16:42:14 +0000 Message-ID: <56C1FFE6.1010806@nvidia.com> References: <1455544758-7718-1-git-send-email-jonathanh@nvidia.com> <743509d913cbc0e725bea52281be03b009e02bb5.1455553501.git.viresh.kumar@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <743509d913cbc0e725bea52281be03b009e02bb5.1455553501.git.viresh.kumar@linaro.org> Sender: linux-kernel-owner@vger.kernel.org To: Viresh Kumar , Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-pm@vger.kernel.org On 15/02/16 16:26, Viresh Kumar wrote: > We are currently required to do two checks for regulator pointer: > IS_ERR() and IS_NULL(). > > And multiple instances are reported, about both of these not being used > consistently and so resulting in crashes. > > Fix that by initializing regulator pointer with an error value and > checking it only against an error. > > This makes code consistent and efficient. > > Reported-by: Jon Hunter > Signed-off-by: Viresh Kumar Tested-by: Jon Hunter Thanks Jon From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752714AbcBOQmV (ORCPT ); Mon, 15 Feb 2016 11:42:21 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:12442 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326AbcBOQmS (ORCPT ); Mon, 15 Feb 2016 11:42:18 -0500 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 15 Feb 2016 08:42:28 -0800 Subject: Re: [PATCH] PM / OPP: Initialize regulator pointer to an error value To: Viresh Kumar , Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd References: <1455544758-7718-1-git-send-email-jonathanh@nvidia.com> <743509d913cbc0e725bea52281be03b009e02bb5.1455553501.git.viresh.kumar@linaro.org> CC: , , From: Jon Hunter Message-ID: <56C1FFE6.1010806@nvidia.com> Date: Mon, 15 Feb 2016 16:42:14 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <743509d913cbc0e725bea52281be03b009e02bb5.1455553501.git.viresh.kumar@linaro.org> X-Originating-IP: [10.21.132.159] X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/02/16 16:26, Viresh Kumar wrote: > We are currently required to do two checks for regulator pointer: > IS_ERR() and IS_NULL(). > > And multiple instances are reported, about both of these not being used > consistently and so resulting in crashes. > > Fix that by initializing regulator pointer with an error value and > checking it only against an error. > > This makes code consistent and efficient. > > Reported-by: Jon Hunter > Signed-off-by: Viresh Kumar Tested-by: Jon Hunter Thanks Jon