From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752553AbbHTN0x (ORCPT ); Thu, 20 Aug 2015 09:26:53 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:58374 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbbHTN0v (ORCPT ); Thu, 20 Aug 2015 09:26:51 -0400 From: Arnd Bergmann To: linaro-kernel@lists.linaro.org Cc: Viresh Kumar , broonie@kernel.org, Liam Girdwood , "open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK" Subject: Re: [PATCH] regulator: core: Use IS_ERR_OR_NULL() Date: Thu, 20 Aug 2015 15:26:41 +0200 Message-ID: <1600359.hvYhnkmyof@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <3608f46110fb5b66e4e94f18a9af3283d4149fe8.1439794825.git.viresh.kumar@linaro.org> References: <3608f46110fb5b66e4e94f18a9af3283d4149fe8.1439794825.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:gnGIvolGMMQM5b5+ZDKv4p5mknqjo1wx6cNMkNHf4Ew09/6+3Hu iTf2leUFOFqwHypJRgV1keI7MJYf72uJVE40GmCkuSarFcXQbQfw1LsRTjW0lMzIk5/cSv4 ZnQzcLwolkZq1/cpTWNY58l68O15iYvrXzii/RrhwXEIeDvuRpqC1Ew5KUsei/Ttd/8ecqt QARS7zdyvPM6lRZsG2r9g== X-UI-Out-Filterresults: notjunk:1;V01:K0:/o+W+kXm2uo=:wvA1ZKkPsWX85SECLVYNNv BX5tOsQaB6imOhFyvZsx8yyUmymXPOyuyRw6ojgPDmJDFKpU/tc0sonZc6SzSjlWXPb0hHLds SIE0BxFlpsylkPGpXJoOk7CUX1rhP5EaLZlEzgqZH/1DG04KK5ngXojk+0Pv0w3M5hRv94cGq CdNQQGOdiFe2Gx0860EDswJty09VuD00dsNSG2tnLusxId8b/uEgh0T+TK1b/qX4p/tyeo3lO Xi5N4kljxktCInyI5DkT7BX0aR1scpCxeP8zqai7TFtLuE2i2zFxDCsZAYfcthnmjhHeV/d04 4vyf60Lpl9AcmFmzu+Pj8nNYBZb6Krty/sSsUsDdtkbv5Od6ozy6GN4cvP06upgHu/WZ6Fm3e qN4aQGAN+ioh9yWq5CVHRb7mTKyaezX4Np3u8/cneZrEttsdOojMADENuMSbG1+EbXSj+2OZ3 tE/CymzOe1ewhoInycqjnI0Gons6AS/Lq3EXtt1H2p0Mm1asjLrUZi8a8nndggXaCL+vZtz0h jDBJHhEqpm/O0xjdf66eGLH+13EuXPcOVBcavAxRSKBP4LMDzT02NGjDI8nGJtKkwM4Yl2WM4 HMePZ+xCHTFB3ey9vFAuw8ZJm9DO0EE9WbAvNxWaqAL/36cEnv/my1Jt/uNxP+KODYpcxDMrT 4mVUmW678XTf5QSx1prWcuSHDvbpKzXVvLctbxZ21r3OIRzzZAFvc8vLJr+AfYWvdT6j0nE1s sUpP7JhTmlxWIA7n Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 17 August 2015 12:30:58 Viresh Kumar wrote: > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c > index 78387a6cbae5..55b49acfd9b3 100644 > --- a/drivers/regulator/core.c > +++ b/drivers/regulator/core.c > @@ -1595,7 +1595,7 @@ static void _regulator_put(struct regulator *regulator) > { > struct regulator_dev *rdev; > > - if (regulator == NULL || IS_ERR(regulator)) > + if (IS_ERR_OR_NULL(regulator)) > return; The use of IS_ERR_OR_NULL is almost always a bug (as is the open-coded equivalent). Please try to find out why this is done here and add a comment if it's actually correct, or fix it if not. My guess is that it is not ok to pass an error pointer as the argument of _regulator_put(), so maybe there should be WARN_ON()? Arnd