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


Groups > linux.kernel > #1298602

Re: [media] tuners: One check less in m88rs6000t_get_rf_strength() after error detection

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject Re: [media] tuners: One check less in m88rs6000t_get_rf_strength() after error detection
Date 2015-12-28 11:40 +0100
Message-ID <qKDnz-AY-1@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <qKC89-8ir-5@gated-at.bofh.it> <qKChP-8lQ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>> Move the jump label directly before the desired log statement
>> so that the variable "ret" will not be checked once more
>> after it was determined that a function call failed.
> 
> Why not avoid both unnecessary ifs

I would find such a fine-tuning also nice in principle at more source code places.


> and the enormous ugliness of a label inside an if by making two returns:
> a return 0 for success and a dev_dbg and return ret for failure?

How should your suggestion finally work when the desired execution success
can be determined for such functions only after several other calls succeeded?

Is consistent checking of failure predicates usually required?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH] [media] tuners: One check less in  m88rs6000t_get_rf_strength() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 10:20 +0100
  Re: [PATCH] [media] tuners: One check less in m88rs6000t_get_rf_strength()  after error detection Julia Lawall <julia.lawall@lip6.fr> - 2015-12-28 10:30 +0100
    Re: [media] tuners: One check less in m88rs6000t_get_rf_strength()  after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 11:40 +0100
      Re: [media] tuners: One check less in m88rs6000t_get_rf_strength()  after error detection Julia Lawall <julia.lawall@lip6.fr> - 2015-12-28 11:40 +0100
        [PATCH 0/2] [media] m88rs6000t: Fine-tuning for some function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 15:40 +0100
          [PATCH 1/2] [media] m88rs6000t: Better exception handling in five  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 15:40 +0100
            Re: [PATCH 1/2] [media] m88rs6000t: Better exception handling in  five functions Julia Lawall <julia.lawall@lip6.fr> - 2015-12-28 15:50 +0100
              Re: [media] m88rs6000t: Better exception handling in five functions SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 16:10 +0100
                Re: [media] m88rs6000t: Better exception handling in five  functions Julia Lawall <julia.lawall@lip6.fr> - 2015-12-28 16:20 +0100
          [PATCH 2/2] [media] tuners: Refactoring for m88rs6000t_sleep() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 15:50 +0100

csiph-web