mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 17:43:59 +00:00
spi-topcliff-pch: fix -Wuninitialized warning
Fix for: drivers/spi/spi-topcliff-pch.c: In function ‘pch_spi_handler_sub’: drivers/spi/spi-topcliff-pch.c:325:17: warning: ‘bpw_len’ may be used uninitialized in this function [-Wuninitialized] drivers/spi/spi-topcliff-pch.c:325:42: warning: ‘rx_index’ may be used uninitialized in this function [-Wuninitialized] drivers/spi/spi-topcliff-pch.c:325:42: warning: ‘tx_index’ may be used uninitialized in this function [-Wuninitialized] Move usage of tx_index, rx_index and bpw_len into the same block as where they are set to prevent uninitialized usage. v2: instead of init variables with 0 move the whole block Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
690fb11be3
commit
de3bd7e6de
@ -318,13 +318,12 @@ static void pch_spi_handler_sub(struct pch_spi_data *data, u32 reg_spsr_val,
|
|||||||
data->tx_index = tx_index;
|
data->tx_index = tx_index;
|
||||||
data->rx_index = rx_index;
|
data->rx_index = rx_index;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if transfer complete interrupt */
|
/* if transfer complete interrupt */
|
||||||
if (reg_spsr_val & SPSR_FI_BIT) {
|
if (reg_spsr_val & SPSR_FI_BIT) {
|
||||||
if ((tx_index == bpw_len) && (rx_index == tx_index)) {
|
if ((tx_index == bpw_len) && (rx_index == tx_index)) {
|
||||||
/* disable interrupts */
|
/* disable interrupts */
|
||||||
pch_spi_setclr_reg(data->master, PCH_SPCR, 0, PCH_ALL);
|
pch_spi_setclr_reg(data->master, PCH_SPCR, 0,
|
||||||
|
PCH_ALL);
|
||||||
|
|
||||||
/* transfer is completed;
|
/* transfer is completed;
|
||||||
inform pch_spi_process_messages */
|
inform pch_spi_process_messages */
|
||||||
@ -333,7 +332,9 @@ static void pch_spi_handler_sub(struct pch_spi_data *data, u32 reg_spsr_val,
|
|||||||
wake_up(&data->wait);
|
wake_up(&data->wait);
|
||||||
} else {
|
} else {
|
||||||
dev_err(&data->master->dev,
|
dev_err(&data->master->dev,
|
||||||
"%s : Transfer is not completed", __func__);
|
"%s : Transfer is not completed",
|
||||||
|
__func__);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user