From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033360AbbKFNNN (ORCPT ); Fri, 6 Nov 2015 08:13:13 -0500 Received: from mga03.intel.com ([134.134.136.65]:35324 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033190AbbKFNNM (ORCPT ); Fri, 6 Nov 2015 08:13:12 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,252,1444719600"; d="scan'208";a="844711966" From: Jani Nikula To: SF Markus Elfring , Daniel Vetter , David Airlie , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: Re: GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" In-Reply-To: <563CA349.7030004@users.sourceforge.net> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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> User-Agent: Notmuch/0.20.2+101~gb57168b (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Fri, 06 Nov 2015 15:17:05 +0200 Message-ID: <87egg3l12m.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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