All of lore.kernel.org
 help / color / mirror / Atom feed
From: Levente Kurusa <levex@linux.com>
To: "Geyslan Gregório Bem" <geyslan@gmail.com>
Cc: Caizhiyong <caizhiyong@hisilicon.com>,
	Mark Brown <broonie@kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Wanglin (Albert)" <albert.wanglin@hisilicon.com>,
	Levente Kurusa <levex@linux.com>
Subject: Re: [PATCH] regmap: Fix 'ret' would return an uninitialized value
Date: Fri, 15 Nov 2013 17:03:13 +0100	[thread overview]
Message-ID: <528645C1.3060601@linux.com> (raw)
In-Reply-To: <CAGG-pUQWnFN1pGFGw9BaE7kDt9ODfpCfmuNB1vV0Jn=mTXTVXA@mail.gmail.com>

2013-11-15 16:52 keltezéssel, Geyslan Gregório Bem írta:
> 2013/11/15 Levente Kurusa <levex@linux.com>:
>> 2013-11-15 14:00 keltezéssel, Geyslan Gregório Bem írta:
>>> 2013/11/15 Caizhiyong <caizhiyong@hisilicon.com>:
>>>> From: Cai Zhiyong <caizhiyong@huawei.com>
>>>> Date: Mon, 11 Nov 2013 19:26:14 +0800
>>>> Subject: [PATCH] regmap: Fix 'ret' would return an uninitialized value
>>>>
>>>> This patch give a warning when calling regmap_register_patch with
>>>> parameter num_regs <= 0.
>>>>
>>>> When the num_regs parameter is zero and krealloc doesn't fail,
>>>> then the code would return an uninitialized value. However,
>>>> calling this function with num_regs == 0, would be a waste as it
>>>> essentially does nothing.
>>>>
>>>> Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
>>> Reviewed-by: Geyslan G. Bem <geyslan@gmail.com>
>>>
>>> Seems a good approach.
>>>
>>
>> The patch doesn't apply. After manually applying this it
>> threw a compilation error:
>>
>> drivers/base/regmap/regmap.c: In function ‘regmap_register_patch’:
>> drivers/base/regmap/regmap.c:2176:6: error: expected expression before ‘)’ token
>>
>>
>> Cai,
>> You have missed the second parameter of WARN_ONCE().
>> Please append what you'd prefer to have outputten once the condition evaluates to true.
>>
>> --
>> Regards,
>> Levente Kurusa
> Cai, Levente,
> 
> Maybe this:
> 
> +       if (WARN_ONCE(num_regs <= 0, "number of registers [%d] must be
> major than 0", num_regs))
> +               return 0;
> +
> 

It is fine, but I think outputting num_regs is unnecessary.
Also, that line is more than 80 characters, so please wrap it.

-- 
Regards,
Levente Kurusa

  parent reply	other threads:[~2013-11-15 16:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15 11:30 [PATCH] regmap: Fix 'ret' would return an uninitialized value Caizhiyong
2013-11-15 13:00 ` Geyslan Gregório Bem
2013-11-15 13:27   ` Levente Kurusa
2013-11-15 15:52     ` Geyslan Gregório Bem
2013-11-15 15:58       ` Mark Brown
2013-11-15 16:09         ` Geyslan Gregório Bem
2013-11-15 16:03       ` Levente Kurusa [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-11-18 12:29 Caizhiyong
2013-11-18 12:35 ` Mark Brown
2013-11-18 13:24 ` Geyslan Gregório Bem
2013-11-11 11:35 Caizhiyong
2013-11-14 12:58 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528645C1.3060601@linux.com \
    --to=levex@linux.com \
    --cc=albert.wanglin@hisilicon.com \
    --cc=broonie@kernel.org \
    --cc=caizhiyong@hisilicon.com \
    --cc=geyslan@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.