Commit Graph

1222 Commits

Author SHA1 Message Date
Oscar Carter e681bb287f staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
Use DIV_ROUND_UP macro instead of specific code with the same purpose.
Also, remove the unused variables.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Link: https://lore.kernel.org/r/20200326175902.14467-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-27 10:05:52 +01:00
Oscar Carter 3017e587e3 staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
The last parameter in the functions vnt_mac_reg_bits_on and
vnt_mac_reg_bits_off defines the bits to set or unset. So, it's more
clear to use the BIT() macro instead of an hexadecimal value.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200320181326.12156-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-21 11:03:16 +01:00
Oscar Carter a74081b442 staging: vt6656: Use BIT() macro instead of hex value
Use the BIT() macro instead of the hexadecimal value to define the
different bits in registers.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200320171056.7841-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-21 10:58:16 +01:00
Oscar Carter cad144d6e5 staging: vt6656: Use ARRAY_SIZE instead of hardcoded size
Use ARRAY_SIZE to replace the hardcoded size so we will never have a
mismatch.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200318174015.7515-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-19 15:13:41 +01:00
Oscar Carter d8dd36459d staging: vt6656: Use BIT_ULL() macro instead of bit shift operation
Replace the bit left shift operation with the BIT_ULL() macro and remove
the unnecessary mask off operation against the bit_nr variable.

This mask is only there for legacy reasons. Originally it was 31 (0x1f)
and the bit_nr variable spread across an mc_filter array with two u32
elements. Now, this mask is not needed because its value is 0x3f and the
mc_filter variable is an u64 type.

In this situation, the 26 bit right shift operation against the value
returned by the ether_crc function set the bit_nr variable to the
following value:

bit 31 to bit 6 -> All 0 (due to the bit shift operation happens over an
unsigned type).

bit 5 to bit 0 -> The 6 msb bits of the value returned by the ether_crc
function.

The purpose of the 0x3f mask against the bit_nr variable is to reset
(set to 0) the 26 msb bits (bit 31 to bit 6), but these bits are yet 0.
So, the mask off operation is now unnecessary.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200314161441.4870-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-17 12:28:03 +01:00
Malcolm Priestley 696089de8e staging: vt6656: struct vnt_rcb remove unused in_use.
The variable merely toggles true to false and is unused.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/130a4078-2502-a381-46c4-b473815e153b@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-10 10:51:20 +01:00
Malcolm Priestley d1ec124246 staging: vt6656: Remove vnt_interrupt_buffer in_use flag.
mac80211 is the only user of in_use to start it and should
not be true when so.

So internal toggling of this variable is not relevant.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/69585034-4318-4bec-7d9b-f64a167df237@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-10 10:51:20 +01:00
Payal Kshirsagar ad3ee73007 staging: vt6656: remove blank line
To avoid style issues, remove multiple blank lines.

Signed-off-by: Payal Kshirsagar <payalskshirsagar1234@gmail.com>
Acked-by: Julia Lawall <julia.lawall@inria.fr>
Link: https://lore.kernel.org/r/20200309073424.4920-1-payalskshirsagar1234@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-10 10:15:21 +01:00
Oscar Carter 7db73c8c90 staging: vt6656: Remove unnecessary local variables initialization
Don't initialize variables that are then set a few lines later.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Link: https://lore.kernel.org/r/20200301135028.11753-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:54:09 +01:00
Malcolm Priestley 3c505f508f staging: vt6656: Move vnt_rx_data to usbpipe.c
vnt_rx_data is a USB function and vnt_submit_rx_urb_complete is
the only caller therefore removing dpc.c/h files and becoming
static.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/d3937276-5a47-7184-e263-84d9c9cb5c7a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:54:09 +01:00
Malcolm Priestley 10e9a359ce staging: vt6656: Delete int.c/h file and move functions to usbpipe
Move functions vnt_int_process_data and vnt_int_report_rate to
usbpipe.c and vnt_interrupt_data to usbpipe.h

These form part of the USB structure.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/bc21d3d7-81be-4ec1-030e-4e7a45f98238@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:32 +01:00
Malcolm Priestley 05f665dd0f staging: vt6656: Remove function vnt_int_process_data.
call vnt_start_interrupt_urb directly from vnt_start.

Move debug message to vnt_start_interrupt_urb.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/dff3a1d0-4d24-d9ea-2a15-c81fd544bc79@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:32 +01:00
Malcolm Priestley 0fd349fd1d staging: vt6656: vnt_int_start_interrupt remove spin lock.
This formed part of the legacy driver and potentially multi
users.

The driver now has only one user mac80211 remove this lock.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/871a78d4-6d3e-f34b-d0ae-6123803c6faf@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:32 +01:00
Malcolm Priestley f75bb88fef staging: vt6656: vnt_vt3184_init remove stack copy to array.
use u8 pointer addr directly and remove stack array.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/49f34764-c90c-8c5f-b4f2-a3668b13e519@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:32 +01:00
Malcolm Priestley c3aee66261 staging: vt6656: use vnt_vt3184_agc array directly
vnt_vt3184_agc is always the same regardless of rf type
so use the array directly removing from stack buffer.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/4b455ee4-7ac7-e1ff-4a10-2d99f2e30714@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:32 +01:00
Malcolm Priestley 2812ab8963 staging: vt6656: Remove STATUS enums from TX path
Returning standard error code or status variable.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/21bf299b-63e0-9f65-c7db-6e0b72e0f1d8@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:31 +01:00
Malcolm Priestley 3b4922deaf staging: vt6656: Use mac80211 duration for tx headers
mac80211 already provides the correct duration simply
copy it to the tx headers removing the need for driver
to find it with vnt_get_duration_le.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/0cdde611-119b-b223-e8c8-b59fb497a7b9@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:31 +01:00
Greg Kroah-Hartman c85f15519d Merge 5.6-rc3 into staging-next
We need the staging fixes in here, and it resolves a merge issue in the
MAINTAINERS file.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-24 08:37:48 +01:00
Malcolm Priestley 93134df520 staging: vt6656: fix sign of rx_dbm to bb_pre_ed_rssi.
bb_pre_ed_rssi is an u8 rx_dm always returns negative signed
values add minus operator to always yield positive.

fixes issue where rx sensitivity is always set to maximum because
the unsigned numbers were always greater then 100.

Fixes: 63b9907f58 ("staging: vt6656: mac80211 conversion: create rx function.")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/aceac98c-6e69-3ce1-dfec-2bf27b980221@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-10 08:49:10 -08:00
Malcolm Priestley 8e2e79ff61 staging: vt6656: Remove fall back functions and headers.
Fall back is no longer used in driver so remove all
functions and headers.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/33732aad-5905-c173-ea81-431265e4f7e7@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-09 16:22:57 -08:00
Malcolm Priestley 88900631d7 staging: vt6656: Fix return for unsupported cipher modes.
mac80211 expect to see -EOPNOTSUPP on unsupported ciphers so
these can be done on stack.

correct all the returns to do this.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/b65a3b23-735f-f679-0f16-a54c3266b5ae@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-09 16:22:56 -08:00
Malcolm Priestley be9bca8cfb staging: vt6656: Disable and remove fall back rates from driver.
The fall back rates are not properly implemented in driver and
form part of the legacy driver.

mac80211 has no indication that this is happening and it
does appear the driver does function considerably better
without them so remove them.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/47cc31e5-226b-f84f-3655-51a269735130@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-09 16:22:56 -08:00
Malcolm Priestley 747a64bd01 staging: vt6656: Remove memory buffer from vnt_download_firmware.
The memory buffer is being done twice here as vnt_control_out passes
it straight to kmemdup.

Remove buffer and add const to the variable in vnt_control_out to pass
the pointer to it.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/be025ed0-204d-e957-4bc9-963e841fcb2c@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 09:52:39 +01:00
Malcolm Priestley 1ca9c73105 staging: vt6656: Just check NEWRSR_DECRYPTOK for RX_FLAG_DECRYPTED.
At present the driver does a number of checks for RX_FLAG_DECRYPTED.

Remove all these and just pass check NEWRSR_DECRYPTOK mac80211
will handle the processing of the sk_buff and dispose of it.

This means that mac80211 can do unsupported encryption modes
on stack.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/75bbaa08-2465-b057-64ce-b67933409bc6@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 09:52:38 +01:00
Malcolm Priestley b653174327 staging: vt6656: Use vnt_rx_tail struct for tail variables.
Place tsf_time, sq, new_rsr, rssi, rsr and sq3 packed in the structure.

Unused variables are removed along with skb_data and structure is
placed beyond vnt_rx_header + pay_load_with_padding on skb->data.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/6ac6eae0-7b71-fefe-9230-da3b345b634b@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 09:52:38 +01:00
Malcolm Priestley 8902ecd70b staging: vt6656: create vnt rx header for sk_buff.
vnt_rx_header contains the structure of the original variables
wbk_status, rx_sts, rx_rate and pay_load_len packed.

Replace all the old variables for the ones in this.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/094ee227-b114-ee75-67f7-bf07f8de099f@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 09:52:38 +01:00
Malcolm Priestley 743b2b7e08 staging: vt6656: Simplify RX finding bit rates
The bit rate can be found by multiplying the rate value by 5.

Use rx_bitrate to compared to sband bitrates removing the need
to find it by hw_value.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/50d3c4b8-6d17-4fae-ce9c-88a50614450f@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 09:52:38 +01:00
Greg Kroah-Hartman d40310f657 Merge 5.5-rc6 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-13 07:52:17 +01:00
Malcolm Priestley ab5caf34f5 staging: vt6656: Move ieee80211_rx_status off stack.
ieee80211_rx_status off stack to IEEE80211_SKB_RXCB (skb->cb)
removing the need to copy on to it.

skb->cb is always present as a clean buffer so simply fill
it in.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/a66caba4-0c17-41af-a58f-3cdbb3243fb0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-10 13:49:20 +01:00
Malcolm Priestley 9dd631fa99 staging: vt6656: Fix false Tx excessive retries reporting.
The driver reporting  IEEE80211_TX_STAT_ACK is not being handled
correctly. The driver should only report on TSR_TMO flag is not
set indicating no transmission errors and when not IEEE80211_TX_CTL_NO_ACK
is being requested.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/340f1f7f-c310-dca5-476f-abc059b9cd97@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-10 13:49:19 +01:00
Malcolm Priestley d579c43c82 staging: vt6656: use NULLFUCTION stack on mac80211
It appears that the drivers does not go into power save correctly the
NULL data packets are not being transmitted because it not enabled
in mac80211.

The driver needs to capture ieee80211_is_nullfunc headers and
copy the duration_id to it's own duration data header.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/610971ae-555b-a6c3-61b3-444a0c1e35b4@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-10 13:49:19 +01:00
Malcolm Priestley d971fdd341 staging: vt6656: correct packet types for CTS protect, mode.
It appears that the driver still transmits in CTS protect mode even
though it is not enabled in mac80211.

That is both packet types PK_TYPE_11GA and PK_TYPE_11GB both use CTS protect.
The only difference between them GA does not use B rates.

Find if only B rate in GB or GA in protect mode otherwise transmit packets
as PK_TYPE_11A.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/9c1323ff-dbb3-0eaa-43e1-9453f7390dc0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-10 13:49:19 +01:00
Malcolm Priestley c0bcf9f3f5 staging: vt6656: set usb_set_intfdata on driver fail.
intfdata will contain stale pointer when the device is detached after
failed initialization when referenced in vt6656_disconnect

Provide driver access to it here and NULL it.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/6de448d7-d833-ef2e-dd7b-3ef9992fee0e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03 11:46:59 +01:00
Malcolm Priestley 07f59f180e staging: vt6656: remove bool from vnt_radio_power_on ret
The driver uses logical only error checking a bool true would flag error.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/cc52b67c-9ef8-3e57-815a-44d10701919e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03 11:46:58 +01:00
Malcolm Priestley 69cc1f925e staging: vt6656: limit reg output to block size
vnt_control_out appears to fail when BBREG is greater than 64 writes.

Create new function that will relay an array in no larger than
the indicated block size.

It appears that this command has always failed but was ignored by
driver until the introduction of error checking.

Cc: stable <stable@vger.kernel.org> # v5.3+
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/a41f0601-df46-ce6e-ab7c-35e697946e2a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03 11:46:57 +01:00
Malcolm Priestley 7de6155c89 staging: vt6656: correct return of vnt_init_registers.
The driver standard error returns remove bool false conditions.

Cc: stable <stable@vger.kernel.org> # v5.3+
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/072ec0b3-425f-277e-130c-1e3a116c90d6@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03 11:46:56 +01:00
Malcolm Priestley 58c3e681b0 staging: vt6656: Fix non zero logical return of, usb_control_msg
Starting with commit 59608cb1de
("staging: vt6656: clean function's error path in usbpipe.c")
the usb control functions have returned errors throughout driver
with only logical variable checking.

However, usb_control_msg return the amount of bytes transferred
this means that normal operation causes errors.

Correct the return function so only return zero when transfer
is successful.

Cc: stable <stable@vger.kernel.org> # v5.3+
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/08e88842-6f78-a2e3-a7a0-139fec960b2b@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03 11:46:55 +01:00
Amir Mahdi Ghorbanian 97806d3602 staging: vt6656: remove unnecessary parenthesis
Remove unnecessary parenthesis to abide by kernel
coding-style.

Signed-off-by: Amir Mahdi Ghorbanian <indigoomega021@gmail.com>
Link: https://lore.kernel.org/r/20191230155520.GA27072@user-ThinkPad-X230
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03 11:04:58 +01:00
Gabriela Bittencourt 164eec46ea staging: vt6656: reorganize characters so the lines are under 80 ch
Cleans up warnings of "line over 80 characters"

Signed-off-by: Gabriela Bittencourt <gabrielabittencourt00@gmail.com>
Link: https://lore.kernel.org/r/20191006194030.8854-1-gabrielabittencourt00@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-07 12:27:59 +02:00
Gabriela Bittencourt f3c3f2d434 staging: vt6656: remove duplicated blank line
Cleans up checks of "don't use multiple blank line"

Signed-off-by: Gabriela Bittencourt <gabrielabittencourt00@gmail.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Link: https://lore.kernel.org/r/20191006195854.9843-1-gabrielabittencourt00@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-07 12:26:58 +02:00
Colin Ian King 17e325285d staging: vt6656: clean up an indentation issue
There is a block of code that is indented incorrectly, add in the
missing tabs.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Link: https://lore.kernel.org/r/20190927092400.20213-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-30 21:58:01 +02:00
Benjamin Sherman 44a22dc3dd staging: vt6656: change alignment to match parenthesis
Change indentation to match parentheses.  This complies with the Linux
kernel coding style and improves readability.

Signed-off-by: Benjamin Sherman <benjamin@bensherman.io>
Link: https://lore.kernel.org/r/20190716045754.fivh5n44bybe2uce@valkyrie-mobile.localdomain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-22 07:34:15 +02:00
Colin Ian King 57744c8d5c staging: vt6656: fix indentation on break statement
The break statement is indented one level too deep, fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20 14:32:07 +02:00
Quentin Deslandes 987d864a23 staging: vt6656: manage error path during device initialization
Check for error during device initialization callback and return a
meaningful error code or zero on success.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 08:25:04 +02:00
Quentin Deslandes 07ba60a158 staging: vt6656: clean-up registers initialization error path
Avoid discarding function's return code during register initialization.
Handle it instead and return 0 on success or a negative errno value on
error.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 08:25:04 +02:00
Quentin Deslandes d8c2869300 staging: vt6656: use meaningful error code during buffer allocation
Check on called function's returned value for error and return 0 on
success or a negative errno value on error instead of a boolean value.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 08:25:04 +02:00
Quentin Deslandes cc81234ad7 staging: vt6656: clean error path for firmware management
Avoid discarding return value of functions called during firmware
management process. Handle such return value and return 0 on success or
a negative errno value on error.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 08:25:04 +02:00
Quentin Deslandes 7156f7d9c3 staging: vt6656: avoid discarding called function's return code
Change some of the driver's functions in order to handle error codes
instead of discarding them. These function now returns 0 on success and
a negative errno value on error.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 08:25:03 +02:00
Quentin Deslandes 59608cb1de staging: vt6656: clean function's error path in usbpipe.c
Avoid discarding called function's returned value. Store it instead in
order to act accordingly.

Update error path to return 0 on success and a negative errno value on
error.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 08:25:03 +02:00
Quentin Deslandes 3fd14ebc2d staging: vt6656: fix potential NULL pointer dereference
vnt_free_tx_bufs() relies on priv->tx_context elements to be NULL if
they are not initialized (as vnt_free_rx_bufs() does). Add a check to
these elements in order to avoid NULL pointer dereference.

Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 08:25:03 +02:00