ath10k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message
@ 2019-06-27 18:47 Kalle Valo
  2019-06-27 18:47 ` [PATCH 2/2] ath10k: pci: remove unnecessary casts Kalle Valo
  2019-06-28 19:14 ` [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message Kalle Valo
  0 siblings, 2 replies; 6+ messages in thread
From: Kalle Valo @ 2019-06-27 18:47 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless

Fixes checkpatch warning:

drivers/net/wireless/ath/ath10k/swap.c:110: Possible unnecessary 'out of memory' message

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/swap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/swap.c b/drivers/net/wireless/ath/ath10k/swap.c
index 4dddeee684b4..7198a386f2fb 100644
--- a/drivers/net/wireless/ath/ath10k/swap.c
+++ b/drivers/net/wireless/ath/ath10k/swap.c
@@ -106,10 +106,8 @@ ath10k_swap_code_seg_alloc(struct ath10k *ar, size_t swap_bin_len)
 
 	virt_addr = dma_alloc_coherent(ar->dev, swap_bin_len, &paddr,
 				       GFP_KERNEL);
-	if (!virt_addr) {
-		ath10k_err(ar, "failed to allocate dma coherent memory\n");
+	if (!virt_addr)
 		return NULL;
-	}
 
 	seg_info->seg_hw_info.bus_addr[0] = __cpu_to_le32(paddr);
 	seg_info->seg_hw_info.size = __cpu_to_le32(swap_bin_len);
-- 
2.7.4


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] ath10k: pci: remove unnecessary casts
  2019-06-27 18:47 [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message Kalle Valo
@ 2019-06-27 18:47 ` Kalle Valo
  2019-06-27 19:12   ` Johannes Berg
  2019-06-28 19:14 ` [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message Kalle Valo
  1 sibling, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2019-06-27 18:47 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless

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(-)

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;
-- 
2.7.4


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ath10k: pci: remove unnecessary casts
  2019-06-27 18:47 ` [PATCH 2/2] ath10k: pci: remove unnecessary casts Kalle Valo
@ 2019-06-27 19:12   ` Johannes Berg
  2019-06-27 19:15     ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2019-06-27 19:12 UTC (permalink / raw)
  To: Kalle Valo, ath10k; +Cc: linux-wireless

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


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ath10k: pci: remove unnecessary casts
  2019-06-27 19:12   ` Johannes Berg
@ 2019-06-27 19:15     ` Johannes Berg
  2019-06-28  5:08       ` Kalle Valo
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2019-06-27 19:15 UTC (permalink / raw)
  To: Kalle Valo, ath10k; +Cc: linux-wireless

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


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ath10k: pci: remove unnecessary casts
  2019-06-27 19:15     ` Johannes Berg
@ 2019-06-28  5:08       ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-06-28  5:08 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, ath10k

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?

-- 
Kalle Valo

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message
  2019-06-27 18:47 [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message Kalle Valo
  2019-06-27 18:47 ` [PATCH 2/2] ath10k: pci: remove unnecessary casts Kalle Valo
@ 2019-06-28 19:14 ` Kalle Valo
  1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-06-28 19:14 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath10k

Kalle Valo <kvalo@codeaurora.org> wrote:

> Fixes checkpatch warning:
> 
> drivers/net/wireless/ath/ath10k/swap.c:110: Possible unnecessary 'out of memory' message
> 
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

2 patches applied to ath-next branch of ath.git, thanks.

2189135437d0 ath10k: remove unnecessary 'out of memory' message
d44c732cffe5 ath10k: pci: remove unnecessary casts

-- 
https://patchwork.kernel.org/patch/11020277/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-28 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 18:47 [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message Kalle Valo
2019-06-27 18:47 ` [PATCH 2/2] ath10k: pci: remove unnecessary casts Kalle Valo
2019-06-27 19:12   ` Johannes Berg
2019-06-27 19:15     ` Johannes Berg
2019-06-28  5:08       ` Kalle Valo
2019-06-28 19:14 ` [PATCH 1/2] ath10k: remove unnecessary 'out of memory' message Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).