Message ID | 1561661250-30528-2-git-send-email-kvalo@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] ath10k: remove unnecessary 'out of memory' message | expand |
On Thu, 2019-06-27 at 21:47 +0300, Kalle Valo wrote: > Fixes checkpatch warnings: > > drivers/net/wireless/ath/ath10k/pci.c:926: unnecessary cast may hide bugs, see http://c-faq.com/malloc/ma > drivers/net/wireless/ath/ath10k/pci.c:1072: unnecessary cast may hide bugs, see http://c-faq.com/malloc/m I think you cut off the link there, did you mean http://c-faq.com/malloc/mallocnocast.html perhaps? johannes
On Thu, 2019-06-27 at 21:12 +0200, Johannes Berg wrote: > On Thu, 2019-06-27 at 21:47 +0300, Kalle Valo wrote: > > Fixes checkpatch warnings: > > > > drivers/net/wireless/ath/ath10k/pci.c:926: unnecessary cast may hide bugs, see http://c-faq.com/malloc/ma > > drivers/net/wireless/ath/ath10k/pci.c:1072: unnecessary cast may hide bugs, see http://c-faq.com/malloc/m > > I think you cut off the link there, did you mean > http://c-faq.com/malloc/mallocnocast.html perhaps? Which I should've read before replying ... WHAT? We consider calling undeclared functions an *error* in the kernel, this is quite pointless. johannes
Johannes Berg <johannes@sipsolutions.net> writes: > On Thu, 2019-06-27 at 21:12 +0200, Johannes Berg wrote: >> On Thu, 2019-06-27 at 21:47 +0300, Kalle Valo wrote: >> > Fixes checkpatch warnings: >> > >> > drivers/net/wireless/ath/ath10k/pci.c:926: unnecessary cast may >> > hide bugs, see http://c-faq.com/malloc/ma >> > drivers/net/wireless/ath/ath10k/pci.c:1072: unnecessary cast may >> > hide bugs, see http://c-faq.com/malloc/m >> >> I think you cut off the link there, did you mean >> http://c-faq.com/malloc/mallocnocast.html perhaps? Yes, thanks. Fixed now in the pending branch. > Which I should've read before replying ... WHAT? We consider calling > undeclared functions an *error* in the kernel, this is quite pointless. Yeah, the link checkpatch provides is pointless. TBH I didn't even read it until you commented on it :) But the patch is still good to have as there's no point of use casting on void pointers, it's just extra cruft. Right?
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 80bcb2ef5926..a0b4d265c6eb 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -909,7 +909,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data, /* Host buffer address in CE space */ u32 ce_data; dma_addr_t ce_data_base = 0; - void *data_buf = NULL; + void *data_buf; int i; mutex_lock(&ar_pci->ce_diag_mutex); @@ -923,10 +923,8 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data, */ alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT); - data_buf = (unsigned char *)dma_alloc_coherent(ar->dev, alloc_nbytes, - &ce_data_base, - GFP_ATOMIC); - + data_buf = dma_alloc_coherent(ar->dev, alloc_nbytes, &ce_data_base, + GFP_ATOMIC); if (!data_buf) { ret = -ENOMEM; goto done; @@ -1054,7 +1052,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, u32 *buf; unsigned int completed_nbytes, alloc_nbytes, remaining_bytes; struct ath10k_ce_pipe *ce_diag; - void *data_buf = NULL; + void *data_buf; dma_addr_t ce_data_base = 0; int i; @@ -1069,10 +1067,8 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, */ alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT); - data_buf = (unsigned char *)dma_alloc_coherent(ar->dev, - alloc_nbytes, - &ce_data_base, - GFP_ATOMIC); + data_buf = dma_alloc_coherent(ar->dev, alloc_nbytes, &ce_data_base, + GFP_ATOMIC); if (!data_buf) { ret = -ENOMEM; goto done;
Fixes checkpatch warnings: drivers/net/wireless/ath/ath10k/pci.c:926: unnecessary cast may hide bugs, see http://c-faq.com/malloc/ma drivers/net/wireless/ath/ath10k/pci.c:1072: unnecessary cast may hide bugs, see http://c-faq.com/malloc/m While at it, also remove unnecessary initialisation of data_buf variable in both cases. Signed-off-by: Kalle Valo <kvalo@codeaurora.org> --- drivers/net/wireless/ath/ath10k/pci.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)