lkml.org 
[lkml]   [2013]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] regmap: Fix 'ret' would return an uninitialized value
On Mon, Nov 11, 2013 at 11:35:52AM +0000, Caizhiyong wrote:

> + int ret = 0;

With the if statement below you probably don't need to do this any more.

> + if (num_regs <= 0) {
> + WARN_ONCE(1, "Call regmap_register_patch with num_regs <= 0.");
> + return 0;
> + }

WARN_ONCE actually returns the result of the test so you should be able
to write this as:

if (WARN_ONCE(num_regs <= 0))
return 0;

which is slightly neater.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-11-14 14:21    [W:0.038 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site