lkml.org 
[lkml]   [2020]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v7 27/34] i2c: tegra: Check errors for both positive and negative values
    On Wed, Sep 09, 2020 at 01:39:59AM +0300, Dmitry Osipenko wrote:
    > The driver's code is inconsistent in regards to the error values checking.
    > The correct way should be to check both positive and negative values.
    > This patch cleans up the error-checks in the code. Note that the
    > pm_runtime_get_sync() could return positive value on success, hence only
    > relevant parts of the code are changed by this patch.
    >
    > Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
    > Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
    > ---
    > drivers/i2c/busses/i2c-tegra.c | 6 +++---
    > 1 file changed, 3 insertions(+), 3 deletions(-)

    Why? All of these functions "return 0 on success or a negative error
    code on failure", don't they?

    I would actually argue that all of the other checks are wrong. As you
    mention yourself, some functions may decide to return positive values on
    success to convey some extra information, so making this just check for
    non-zero carries a risk of its own.

    Thierry
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2020-09-17 14:12    [W:5.086 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site