lkml.org 
[lkml]   [2019]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] extcon: fix a missing check of regmap_read
    From
    Date
    Hi,

    You better to edit the patch title as following
    in order to sustain the title format for extcon:

    extcon: fix a missing check of regmap_read
    -> extcon: axp288: Fix a missing check of regmap_read


    On 19. 3. 20. 오후 4:35, Kangjie Lu wrote:
    > When regmap_read fails, it doesn't make sense to use the read
    > value "val" because it can be uninitialized.
    >
    > The fix returns if regmap_read fails.
    >
    > Signed-off-by: Kangjie Lu <kjlu@umn.edu>
    > ---
    > drivers/extcon/extcon-axp288.c | 4 ++++
    > 1 file changed, 4 insertions(+)
    >
    > diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
    > index a983708b77a6..b2ba5f073aa7 100644
    > --- a/drivers/extcon/extcon-axp288.c
    > +++ b/drivers/extcon/extcon-axp288.c
    > @@ -143,6 +143,10 @@ static void axp288_extcon_log_rsi(struct axp288_extcon_info *info)
    > int ret;
    >
    > ret = regmap_read(info->regmap, AXP288_PS_BOOT_REASON_REG, &val);
    > + if (ret) {
    > + dev_err(info->dev, "failed to read BOOT_REASON_REG: %d\n", ret);
    > + return;
    > + }

    Have to add the blank line. time.

    And I think that axp288_extcon_log_rsi() have to return the 'error value'
    instead of 'void' return type. And then should handle the return value
    of axp288_extcon_log_rsi() within the axp288_extcon_probe().

    For example,
    ret = axp288_extcon_log_rsi(info)
    if (ret < 0)
    return ret;


    > for (i = 0, rsi = axp288_pwr_up_down_info; *rsi; rsi++, i++) {
    > if (val & BIT(i)) {
    > dev_dbg(info->dev, "%s\n", *rsi);
    >

    --
    Best Regards,
    Chanwoo Choi
    Samsung Electronics

    \
     
     \ /
      Last update: 2019-03-20 09:01    [W:2.594 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site