* [PATCH] GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" [not found] ` <5317A59D.4@users.sourceforge.net> @ 2015-11-06 12:43 ` SF Markus Elfring 2015-11-06 12:52 ` Jani Nikula 0 siblings, 1 reply; 4+ messages in thread From: SF Markus Elfring @ 2015-11-06 12:43 UTC (permalink / raw) To: Daniel Vetter, David Airlie, Jani Nikula, intel-gfx, dri-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 6 Nov 2015 13:38:22 +0100 The pwm_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/gpu/drm/i915/intel_panel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index a24df35..3d8d913 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -1729,8 +1729,7 @@ void intel_panel_destroy_backlight(struct drm_connector *connector) struct intel_panel *panel = &intel_connector->panel; /* dispose of the pwm */ - if (panel->backlight.pwm) - pwm_put(panel->backlight.pwm); + pwm_put(panel->backlight.pwm); panel->backlight.present = false; } -- 2.6.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" 2015-11-06 12:43 ` [PATCH] GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" SF Markus Elfring @ 2015-11-06 12:52 ` Jani Nikula 2015-11-06 12:55 ` SF Markus Elfring 0 siblings, 1 reply; 4+ messages in thread From: Jani Nikula @ 2015-11-06 12:52 UTC (permalink / raw) To: SF Markus Elfring, Daniel Vetter, David Airlie, intel-gfx, dri-devel Cc: Julia Lawall, kernel-janitors, LKML On Fri, 06 Nov 2015, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 6 Nov 2015 13:38:22 +0100 > > 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. BR, Jani. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/gpu/drm/i915/intel_panel.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c > index a24df35..3d8d913 100644 > --- a/drivers/gpu/drm/i915/intel_panel.c > +++ b/drivers/gpu/drm/i915/intel_panel.c > @@ -1729,8 +1729,7 @@ void intel_panel_destroy_backlight(struct drm_connector *connector) > struct intel_panel *panel = &intel_connector->panel; > > /* dispose of the pwm */ > - if (panel->backlight.pwm) > - pwm_put(panel->backlight.pwm); > + pwm_put(panel->backlight.pwm); > > panel->backlight.present = false; > } -- Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" 2015-11-06 12:52 ` Jani Nikula @ 2015-11-06 12:55 ` SF Markus Elfring 2015-11-06 13:17 ` Jani Nikula 0 siblings, 1 reply; 4+ messages in thread From: SF Markus Elfring @ 2015-11-06 12:55 UTC (permalink / raw) To: Jani Nikula, Daniel Vetter, David Airlie, intel-gfx, dri-devel Cc: LKML, kernel-janitors, Julia Lawall >> 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? Regards, Markus ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" 2015-11-06 12:55 ` SF Markus Elfring @ 2015-11-06 13:17 ` Jani Nikula 0 siblings, 0 replies; 4+ messages in thread From: Jani Nikula @ 2015-11-06 13:17 UTC (permalink / raw) To: SF Markus Elfring, Daniel Vetter, David Airlie, intel-gfx, dri-devel Cc: Julia Lawall, kernel-janitors, LKML On Fri, 06 Nov 2015, SF Markus Elfring <elfring@users.sourceforge.net> 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 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-06 13:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5307CAA2.8060406@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
[not found] ` <530A086E.8010901@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
[not found] ` <530A72AA.3000601@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
[not found] ` <530B5FB6.6010207@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
[not found] ` <530C5E18.1020800@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
[not found] ` <530CD2C4.4050903@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
[not found] ` <530CF8FF.8080600@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
[not found] ` <530DD06F.4090703@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
[not found] ` <5317A59D.4@users.sourceforge.net>
2015-11-06 12:43 ` [PATCH] GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" SF Markus Elfring
2015-11-06 12:52 ` Jani Nikula
2015-11-06 12:55 ` SF Markus Elfring
2015-11-06 13:17 ` Jani Nikula
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox