Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: ab8500-core: Return zero in get_register_interruptible()

This function is supposed to return zero on success or negative error
codes on error. Unfortunately, there is a bug so it sometimes returns
non-zero, positive numbers on success.

I noticed this bug during review and I can't test it. It does appear
that the return is sometimes propogated back to _regmap_read() where all
non-zero returns are treated as failure so this may affect run time.

Fixes: 47c1697508f2 ("mfd: Align ab8500 with the abx500 interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Dan Carpenter and committed by
Lee Jones
10628e3e a54e950f

+1 -1
+1 -1
drivers/mfd/ab8500-core.c
··· 261 261 mutex_unlock(&ab8500->lock); 262 262 dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret); 263 263 264 - return ret; 264 + return (ret < 0) ? ret : 0; 265 265 } 266 266 267 267 static int ab8500_get_register(struct device *dev, u8 bank,