mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-29 04:41:21 -04:00
gpio: pca953x: avoid logically dead code
The current code logic make the condition "else if (reg >= 0x54)"
can't be true, cause the dead code. So fix it to match the coder
expectation. This is reported by Coverity.
Fixes: 13c5d4ce80 ("gpio: pca953x: Add support for PCAL6534")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
committed by
Bartosz Golaszewski
parent
29f5c6e69f
commit
b1453d1eb9
@@ -309,17 +309,7 @@ static bool pcal6534_check_register(struct pca953x_chip *chip, unsigned int reg,
|
||||
int bank;
|
||||
int offset;
|
||||
|
||||
if (reg >= 0x30) {
|
||||
/*
|
||||
* Reserved block between 14h and 2Fh does not align on
|
||||
* expected bank boundaries like other devices.
|
||||
*/
|
||||
int temp = reg - 0x30;
|
||||
|
||||
bank = temp / NBANK(chip);
|
||||
offset = temp - (bank * NBANK(chip));
|
||||
bank += 8;
|
||||
} else if (reg >= 0x54) {
|
||||
if (reg >= 0x54) {
|
||||
/*
|
||||
* Handle lack of reserved registers after output port
|
||||
* configuration register to form a bank.
|
||||
@@ -329,6 +319,16 @@ static bool pcal6534_check_register(struct pca953x_chip *chip, unsigned int reg,
|
||||
bank = temp / NBANK(chip);
|
||||
offset = temp - (bank * NBANK(chip));
|
||||
bank += 16;
|
||||
} else if (reg >= 0x30) {
|
||||
/*
|
||||
* Reserved block between 14h and 2Fh does not align on
|
||||
* expected bank boundaries like other devices.
|
||||
*/
|
||||
int temp = reg - 0x30;
|
||||
|
||||
bank = temp / NBANK(chip);
|
||||
offset = temp - (bank * NBANK(chip));
|
||||
bank += 8;
|
||||
} else {
|
||||
bank = reg / NBANK(chip);
|
||||
offset = reg - (bank * NBANK(chip));
|
||||
|
||||
Reference in New Issue
Block a user