summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/davicom/dm9051.c
AgeCommit message (Collapse)AuthorFilesLines
2023-08-24net: dm9051: Use PTR_ERR_OR_ZERO() to simplify codeYu Liao1-3/+1
Use the standard error pointer macro to shorten the code and simplify. Signed-off-by: Yu Liao <liaoyu15@huawei.com> Link: https://lore.kernel.org/r/20230822021455.205101-2-liaoyu15@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-08-19net: dm9051: Use PTR_ERR_OR_ZERO() to simplify codeRuan Jinjie1-4/+1
Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to simplify code. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Link: https://lore.kernel.org/r/20230817022418.3588831-1-ruanjinjie@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-03-11net: Replace all spi->chip_select and spi->cs_gpiod references with function ↵Amit Kumar Mahapatra1-1/+1
call Supporting multi-cs in spi drivers would require the chip_select & cs_gpiod members of struct spi_device to be an array. But changing the type of these members to array would break the spi driver functionality. To make the transition smoother introduced four new APIs to get/set the spi->chip_select & spi->cs_gpiod and replaced all spi->chip_select and spi->cs_gpiod references with get or set API calls. While adding multi-cs support in further patches the chip_select & cs_gpiod members of the spi_device structure would be converted to arrays & the "idx" parameter of the APIs would be used as array index i.e., spi->chip_select[idx] & spi->cs_gpiod[idx] respectively. Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com> Reviewed-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/20230310173217.3429788-3-amit.kumar-mahapatra@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-23net: dm9051: Fix missing dev_kfree_skb() in dm9051_loop_rx()Yuan Can1-1/+3
The dm9051_loop_rx() returns without release skb when dm9051_stop_mrcmd() returns error, free the skb to avoid this leak. Fixes: 2dc95a4d30ed ("net: Add dm9051 driver") Signed-off-by: Yuan Can <yuancan@huawei.com> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-03-04net: ethernet: Use netif_rx().Sebastian Andrzej Siewior1-1/+1
Since commit baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any context.") the function netif_rx() can be used in preemptible/thread context as well as in interrupt context. Use netif_rx(). Cc: Łukasz Stelmach <l.stelmach@samsung.com> Cc: Horatiu Vultur <horatiu.vultur@microchip.com> Cc: UNGLinuxDriver@microchip.com Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-28net: dm9051: Make remove() callback a void functionStephen Rothwell1-3/+1
Changes introduced since the merge window in the spi subsystem and available at: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git tags/spi-remove-void make the remove() callback for spi return void rather than int, breaking the newly added dm9051 driver fail to build. This patch fixes this issue, converting the remove() function provided by the driver to return void. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> [Rewrote commit message -- broonie] Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220228173957.1262628-2-broonie@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-22net: dm9051: Fix use after free in dm9051_loop_tx()Dan Carpenter1-1/+3
This code dereferences "skb" after calling dev_kfree_skb(). Fixes: 2dc95a4d30ed ("net: Add dm9051 driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20220221105440.GA10045@kili Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-17net: Fix an ignored error return from dm9051_get_regs()Yang Li1-1/+1
The return from the call to dm9051_get_regs() is int, it can be a negative error code, however this is being assigned to an unsigned int variable 'ret', so making 'ret' an int. Eliminate the following coccicheck warning: ./drivers/net/ethernet/davicom/dm9051.c:527:5-8: WARNING: Unsigned expression compared with zero: ret < 0 Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Link: https://lore.kernel.org/r/20220216014507.109117-1-yang.lee@linux.alibaba.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-15net: dm9051: Fix spelling mistake "eror" -> "error"Colin Ian King1-2/+2
There are spelling mistakes in debug messages. Fix them. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-14net: Add dm9051 driverJoseph CHAMG1-0/+1260
Add davicom dm9051 spi ethernet driver, The driver work for the device platform which has the spi master Signed-off-by: Joseph CHAMG <josright123@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>