[SLOF] [PATCH v2] usb-xhci: assign field4 before conditional
Alexey Kardashevskiy
aik at ozlabs.ru
Tue Jun 7 18:19:33 AEST 2016
On 02/06/16 20:49, Nikunj A Dadhania wrote:
> Static analysis tool reported:
>
> file lib/libusb/usb-xhci.c
> line 1022
> uninitialized `field4'
>
> file lib/libusb/usb-xhci.c
> line 1036
> uninitialized `field4'
>
> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
Thanks, applied.
> ---
> lib/libusb/usb-xhci.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/lib/libusb/usb-xhci.c b/lib/libusb/usb-xhci.c
> index 3bbc9af..a3e9adc 100644
> --- a/lib/libusb/usb-xhci.c
> +++ b/lib/libusb/usb-xhci.c
> @@ -1017,9 +1017,9 @@ static void fill_setup_data(struct xhci_command_trb *cmd, void *data,
> field1 = TRB_ADDR_LOW(data);
> field2 = TRB_ADDR_HIGH(data);
> field3 = size;
> + field4 = TRB_CMD_TYPE(TRB_DATA_STAGE);
> if (dir)
> - field4 = TRB_DIR_IN;
> - field4 |= TRB_CMD_TYPE(TRB_DATA_STAGE);
> + field4 |= TRB_DIR_IN;
> fill_trb_buff(cmd, field1, field2, field3, field4);
> }
>
> @@ -1030,10 +1030,9 @@ static void fill_status_trb(struct xhci_command_trb *cmd, uint32_t dir)
> field1 = 0;
> field2 = 0;
> field3 = 0;
> + field4 = TRB_CMD_TYPE(TRB_STATUS_STAGE) | TRB_IOC;
> if (dir)
> - field4 = TRB_DIR_IN;
> -
> - field4 |= TRB_CMD_TYPE(TRB_STATUS_STAGE) | TRB_IOC;
> + field4 |= TRB_DIR_IN;
> fill_trb_buff(cmd, field1, field2, field3, field4);
> }
>
>
--
Alexey
More information about the SLOF
mailing list