From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jani Nikula Date: Fri, 06 Nov 2015 13:17:05 +0000 Subject: Re: GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" Message-Id: <87egg3l12m.fsf@intel.com> List-Id: References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <563CA07D.30805@users.sourceforge.net> <87h9kzl27o.fsf@intel.com> <563CA349.7030004@users.sourceforge.net> In-Reply-To: <563CA349.7030004@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring , Daniel Vetter , David Airlie , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML On Fri, 06 Nov 2015, SF Markus Elfring wrote: >>> The pwm_put() function tests whether its argument is NULL and then >>> returns immediately. Thus the test around the call is not needed. >> >> The compiler doesn't need it, but IMO it's useful documentation for humans. > > How do you think about to extend the explicit documentation for > the affected parameters in the Linux programming interfaces? The question is, while reading intel_panel.c, which one conveys the reader better the idea that panel->backlight.pwm may be NULL for some connectors: a) if (panel->backlight.pwm) pwm_put(panel->backlight.pwm); b) pwm_put(panel->backlight.pwm); No amount of documentation in pwm_put() kernel-doc is going to help with that. In most cases, panel->backlight.pwm is in fact NULL. IMO unconditionally calling pwm_put() on it gives the reader the wrong idea. Others may disagree. BR, Jani. -- Jani Nikula, Intel Open Source Technology Center