summaryrefslogtreecommitdiff
path: root/drivers/staging/slicoss
AgeCommit message (Collapse)Author
2014-05-25staging: slicoss: clean up use of dev_errDavid Matlack
First, don't print pci device information or driver prefixes, this is already printed by dev_err. Next, don't report error messages via dev_err when the failing function already reports all errors via dev_err. Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-25staging: slicoss: remove private netdev listDavid Matlack
Remove the private linked list of netdev structs. This list isn't being used anyway. This patch has no noticable effect. Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: handle errors from slic_config_getDavid Matlack
slic_config_get() can fail. Change the return type from void to int and handle the error in slic_card_init(). So now, instead of silently failing (and then timing out waiting for the config data), the driver will fail loudly at request time. Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: fail on corrupt eepromDavid Matlack
Remove fail_on_bad_eeprom, which was always 0 and thus being used to ignore incorrect checksumming. This means devices with corrupt eeprom will now cause the driver to fail. Since fail_on_bad_eeprom was the last member in use of struct slic_reg_params, remove that struct altogether. Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: fix eeprom checksum codeDavid Matlack
Rewrite slic_eeprom_cksum() to fix bugs and make readable. This patch technically has no effect on the user as failed eeprom checksums are ignored anyway. The original implementation had the following issues: 1. 2 of the 3 unrolled loops had the following bug: while ((len -= 32) >= 0) { [...] sum += w[15]; w = (u16 *)((ulong) w + 16); /* verify */ } This processes 32-bytes of data but only increments the word pointer by 16 bytes. Fixing both of these bugs seems to fix slic_eeprom_cksum(). 2. Non-descriptive variable names, use of unions, and macros that change local state make the code difficult to read. 3. The checksum loop is unrolled which makes the code harder to reason about while providing small performance improvement: - max eeprom length is 0x80 bytes (MAX_EECODE_SIZE), that's only 0x40 iterations - checksum is only computed during pci probe(), so not very often Tested on Mojave card Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: fix use-after-free bug in slic_entry_removeDavid Matlack
This patch fixes a use-after-free bug that causes a null pointer dereference in slic_entry_halt. Since unregister_netdev() will ultimately call slic_entry_halt (the net_device ndo_stop() virtual function for this device), we should call it before freeing the memory used by slic_entry_halt. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: fix 64-bit isr address bugDavid Matlack
This patch fixes a bug that only manifests when the physical address of the interrupt status register is >4GB. Specifically, the driver was only telling the device about the lower 32 bits of the ISR. This patch adds the upper 32 bits. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: fix dma memory leakDavid Matlack
This patch fixes a memory leak in slic_card_init. If the driver fails to poll for an interrupt after requesting config data from the device the dma memory is never freed. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: remove gratuitous debug infrastructureDavid Matlack
As per the TODO file, this patch removes the gratuitous debug infrastructure. As an extra incentive for removing this code, the debugfs files are not cleaned up properly. For example, if register_netdev() fails in slic_entry_probe() then all debugfs files get left behind, even after the driver module is unloaded. Touching these files quickly leads to an oops. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: remove unused members of struct adapterDavid Matlack
This patch removes two fields from the private "struct adapter". Specifically, memorybase duplicate of slic_regs memorylength written once and never read. This field is trivially computed with pci_resource_len if it's ever needed in the future. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: fix multiple free-after-free in slic_entry_removeDavid Matlack
This patch fixes two free-after-free bugs in slic_entry_remove. Specifically, slic_unmap_mmio_space() iounmaps adapter->slic_regs, which is the same region of memory as dev->base_addr (iounmap-ed a few lines later). Next, both release_mem_region() and pci_release_regions() are called on the same pci_dev struct. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23staging: slicoss: fix use-after-free in slic_entry_probeDavid Matlack
This patch fixes a use-after-free bug that can cause a kernel oops. If slic_card_init fails then slic_entry_probe (the pci probe() function for this device) will return error without cleaning up memory. Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-25Staging: slicoss: Fix smatch warning in slicoss.cMonam Agarwal
This patch fixes following smatch warning: slicoss/slicoss.c:1429 slic_cmdq_addcmdpage() error: we previously assumed 'pslic_handle' could be null Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-18staging: slicoss: free IO remapping on failureKristina Martšenko
Make sure iounmap is always called after ioremap when module loading fails. Also remove a call to release_mem_region because that region is never reserved in the first place. Fixes the following issue reported by Coccinelle: drivers/staging/slicoss/slicoss.c:3727:1-7: ERROR: missing iounmap; ioremap on line 3661 and execution via conditional on line 3677 Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17Staging: slicoss: Replace macro with inline defination in slicoss.cMonam Agarwal
This patch moves the macro "SLIC_GET_SLIC_HANDLE(_adapter, _pslic_handle)" to inline in slicoss.c since it has been used only once. Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-16staging: slicoss: Fix unnecessary line continuationsGulsah Kose
Removed unnecessary line continuations in slicoss.c Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-03-10Staging: slicoss: Removal of unused macros in slicoss.cMonam Agarwal
This patch removes unused macro in slicoss.c as mentioned in TODO tasks. Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
2014-02-27Staging: slicoss: Fix unnecessary whitespace before a quoted newline in ↵Monam Agarwal
slicoss.c This patch fixes the following checkpatch.pl issues in slicoss.c WARNING: unnecessary whitespace before a quoted newline in slicoss.c Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-27Staging: slicoss: Fix quoted string split across linesMonam Agarwal
This patch fixes the following checkpatch.pl issues in slicoss.c WARNING: quoted string split across lines Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-27Staging: slicoss: Fix line over 80 characters in slic.hMonam Agarwal
This patch fixes the following checkpatch.pl issues in slic.h: WARNING: line over 80 characters Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-11staging: slicoss: Add MAINTAINERS entry, break README into TODO & READMEJoe Perches
Adding a MAINTAINERS entry with content from the README. Move the TODO items from the README to a separate TODO file. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-11staging: slicoss: Fix possible reuse of freed memory in timer functionKirill Tkhai
Do not call kfree() till timer function is finished. [This was found using grep. Compiled tested only] Signed-off-by: Kirill Tkhai <tkhai@yandex.ru> CC: Joe Perches <joe@perches.com> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-06staging: slicoss: Remove last reference to compare_ether_addrJoe Perches
And use the normal is_<foo>_ether_addr functions and ETH_ALEN too. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03staging: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro is not preferred. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-27Staging: slicoss: Replace seq_printf with seq_putsRashika Kheria
This patch fixes the following checkpatch.pl warning in slicoss.c: WARNING: Prefer seq_puts to seq_printf Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19Staging: slicoss: Fix quoted string split across linesRashika Kheria
This patch fixes the following checkpatch.pl warning in slicoss.c- WARNING: quoted string split across lines Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19Staging: slicoss: Refactor code by introducing new function ↵Rashika Kheria
slic_interrupt_card_up() This patch fixes the following checkpatch.pl warning in slicoss.c: WARNING: Too many leading tabs - consider code refactoring Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19Staging: slicoss: Replace printk() with pr_debug() or dev_dbg() as requiredRashika Kheria
This patch fixes the following checkpatch.pl warning in slicoss.c: WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ... Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19Staging: slicoss: Removal of if check since debugfs_remove(NULL) is safeRashika Kheria
This patch fixes the following checkpatch.pl warning in slicoss.c: WARNING: debugfs_remove(NULL) is safe this check is probably not required Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17Staging: Convert uses of compare_ether_addr to ether_addr_equalJoe Perches
Preliminary to removing compare_ether_addr altogether: Use the new bool function ether_addr_equal to add some clarity and reduce the likelihood for misuse of compare_ether_addr for sorting. Additionally: Used is_zero_ether_addr, removed now unused variable Converted uses of &foo[0] to foo Done via cocci script: (and a little typing) $ cat compare_ether_addr.cocci @@ expression a,b; @@ - !compare_ether_addr(a, b) + ether_addr_equal(a, b) @@ expression a,b; @@ - compare_ether_addr(a, b) + !ether_addr_equal(a, b) @@ expression a,b; @@ - !ether_addr_equal(a, b) == 0 + ether_addr_equal(a, b) @@ expression a,b; @@ - !ether_addr_equal(a, b) != 0 + !ether_addr_equal(a, b) @@ expression a,b; @@ - ether_addr_equal(a, b) == 0 + !ether_addr_equal(a, b) @@ expression a,b; @@ - ether_addr_equal(a, b) != 0 + ether_addr_equal(a, b) @@ expression a,b; @@ - !!ether_addr_equal(a, b) + ether_addr_equal(a, b) Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13staging: slicoss: fix error return code in slic_entry_probe()Wei Yongjun
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-05staging: slicoss: information leak in ETHTOOL_GSETDan Carpenter
There are some fields in "edata" which have not been cleared. One example is edata.cmd. It leaks uninitialized stack information to the user. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11staging: slicoss: Remove dma_addr_t cast compilation warningsJoe Perches
Eliminate some warnings by casting to unsigned long before casting a dma_addr_t value to a pointer. btw: Does slicoss always work on x86-32? Is a pshmem guaranteed to be accessible by a 32 bit address? Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11staging/slicoss: Use ether_crc for mac hash calculationPeter Huewe
Instead of performing the hash calculation for the mac address by ourself, we can simply reuse ether_crc and shift only the result according to our needs. The code was tested against the previous implementation by verifying both implementations against each other in userspace for 16200000000 different mac addresses, changing the vendor bits of the mac address first. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11staging/slicoss: Fix buffer possible overflow in slic_card_locatePeter Huewe
smatch complains about a possible buffer overflow slicoss.c:3651 slic_card_locate() error: buffer overflow 'physcard->adapter' 4 <= 4 If the for loop is not exited prematurely i++ is executed after the last iteration and thus i can be 4, which is out of bounds for physcard->adapter. -> Add check for this condition and simplify the if statement by inverting the condition. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11staging/slicoss: Fix operation may be undefined warningPeter Huewe
gcc complains about an undefined operation: slicoss.c:1417:19: warning: operation on 'rspq->pageindex' may be undefined [-Wsequence-point] The intended operation was (probably) to retrieve the pageindex + 1 and let it wrap around if it reaches the num_pages. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11staging/slicoss: Remove always true if statementPeter Huewe
skbtype is assigned once to NORMAL_ETHFRAME and then checked if it is NORMAL_ETHFRAME -> remove the checks. This also gets rid of the (false positive) smatch warning: slicoss.c:2829 slic_xmit_start() error: potential NULL dereference 'hcmd'. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11staging/slicoss: Check pointer before dereferencingPeter Huewe
Smatch complains that the variable adapter is dereferenced before it is checked: slicoss.c:906 slic_timer_load_check() warn: variable dereferenced before check 'adapter' (see line 904) -> move the assignment after the check. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: slicoss: Fix space-related checkpatch.pl warningsCruz Julian Bishop
This fixes all instances of "Please, no spaces at start of a new line" "Please, no spaces before tabs" Please note that I probably got the warning names wrong, but they should be close enough for usage here :) Additional post-commit note: There is one comment on line 230ish in slic.h that appears to have lost it's formatting. It was fine when I was working in Geany, but it caught my eye in the below diff. Sorry if it actually happened! Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: slicoss: Fix three checkpatch.pl errors in slicoss.cCruz Julian Bishop
The errors fixed are all instances of "ERROR: do not use assignment in if condition" Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: slicoss: Stop swearing in slicoss.cCruz Julian Bishop
I'm assuming that "CRC shit reg" is referencing the CRC register/registry. Please ignore this patch if "shit" is actually in context Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: slicoss: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: slicoss: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: slicoss: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-26staging: slicoss: fix a leak when kzalloc failDevendra Naga
slic_card_locate does a kzalloc of physcard, and if it fails, in my previous patch i returned -ENOMEM, but left the driver leak the memory if card_hostid == SLIC_HOSTID_DEFAULT, fix this memory leak if the above condition is true Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: slicoss: get rid of slic_cmdqmem_init functionDevendra Naga
this function memset's the cmdqmem, instead do it in slic_cmdq_init. Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: slicoss: remove default case in irqhandlerDevendra Naga
this default statement does nothing in the irqhandler, so remove it Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: slicoss: return -ENOMEM if kzalloc failDevendra Naga
this takes up the error path cleanup, fixes a crash too due to null deref Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: slicoss: remove ASSERT macro altogetherDevendra Naga
remove ASSERT and remove all its callers altogether in the code Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: slicoss: fail out if we dont have a valid firmware fileDevendra Naga
fail instead calling request_firmware with filename as a null string and return -ENOENT Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>