Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1489520

Re: GPU-DRM-TILCDC: Less function calls in tilcdc_convert_slave_node() after error detection

From Jyri Sarha <jsarha@ti.com>
Newsgroups linux.kernel
Subject Re: GPU-DRM-TILCDC: Less function calls in tilcdc_convert_slave_node() after error detection
Date 2016-09-22 22:30 +0200
Message-ID <skiN3-2zX-5@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <sk7HX-3Yu-5@gated-at.bofh.it> <sk7HY-3Yu-41@gated-at.bofh.it> <skfFv-Hc-1@gated-at.bofh.it> <skh4C-1rX-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09/22/16 21:38, SF Markus Elfring wrote:
>>> The of_node_put() function was called in some cases
>>> by the tilcdc_convert_slave_node() function during error handling
>>> even if the passed variable contained a null pointer.
>>>
>>> * Adjust jump targets according to the Linux coding style convention.
>>>
>>> * Split a condition check for resource detection failures so that
>>>   each pointer from these function calls will be checked immediately.
>>>
>>>   See also background information:
>>>   Topic "CWE-754: Improper check for unusual or exceptional conditions"
>>>   Link: https://cwe.mitre.org/data/definitions/754.html
>>>
>>
>> I don't really agree with this patch.
> 
> This kind of feedback can be fine at first glance.
> 
> 
>> There is no harm in calling of_node_put() with NULL as an argument
> 
> The cost of additional function calls will be eventually not noticed
> just because they belong to an exception handling implementation so far.
> 
> 
>> and because of that there is no point in making the function more complex
> 
> There is inherent software complexity involved.
> 

I think the "if (node)" in the of_node_put() is there on purpose,
because it potentially saves the caller one extra if()-statement and
keeps the caller code simpler.

> 
>> and harder to maintain.
> 
> How do you think about to discuss this aspect a bit more?
> 

Keeping the goto labels in right order needs precision and can lead to
subtle errors. Sometimes there is no way to avoid that, but here there is.

Best regards,
Jyri

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] GPU-DRM-TILCDC: Fine-tuning for two function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 10:40 +0200
  [PATCH 2/4] GPU-DRM-TILCDC: Return directly after a failed  kfree_table_init() in tilcdc_convert_slave_node() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 10:40 +0200
    Re: [PATCH 2/4] GPU-DRM-TILCDC: Return directly after a failed  kfree_table_init() in tilcdc_convert_slave_node() Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-22 13:00 +0200
    Re: [PATCH 2/4] GPU-DRM-TILCDC: Return directly after a failed  kfree_table_init() in tilcdc_convert_slave_node() Jyri Sarha <jsarha@ti.com> - 2016-09-22 19:00 +0200
      Re: GPU-DRM-TILCDC: Return directly after a failed kfree_table_init()  in tilcdc_convert_slave_node() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 20:20 +0200
  [PATCH 3/4] GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 10:40 +0200
    Re: [PATCH 3/4] GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection Jyri Sarha <jsarha@ti.com> - 2016-09-22 19:10 +0200
      Re: GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 20:40 +0200
        Re: GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection Jyri Sarha <jsarha@ti.com> - 2016-09-22 22:30 +0200
          Re: GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-23 09:40 +0200
            Re: GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection Jyri Sarha <jsarha@ti.com> - 2016-09-23 12:40 +0200
              Re: GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-23 13:00 +0200
        Re: GPU-DRM-TILCDC: Less function calls in tilcdc_convert_slave_node()  after error detection Rob Clark <robdclark@gmail.com> - 2016-09-23 13:00 +0200
          Re: GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-23 13:30 +0200
            Re: GPU-DRM-TILCDC: Less function calls in tilcdc_convert_slave_node()  after error detection Rob Clark <robdclark@gmail.com> - 2016-09-23 13:40 +0200
              Re: GPU-DRM-TILCDC: Less function calls in  tilcdc_convert_slave_node() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-23 14:20 +0200
                Re: GPU-DRM-TILCDC: Less function calls in tilcdc_convert_slave_node()  after error detection Rob Clark <robdclark@gmail.com> - 2016-09-23 15:10 +0200
  [PATCH 4/4] GPU-DRM-TILCDC: Delete unnecessary variable  initialisations in tilcdc_convert_slave_node() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-22 10:40 +0200

csiph-web