2023-09-19 04:49:31

by Wu Yunchuan

[permalink] [raw]
Subject: [PATCH v2 wireless-next 2/9] carl9170: remove unnecessary (void*) conversions

No need cast (void *) to (struct ar9170 *), (u8 *) or (void*).

Signed-off-by: Wu Yunchuan <[email protected]>
---
drivers/net/wireless/ath/carl9170/usb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index e4eb666c6eea..c4edf8355941 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -178,7 +178,7 @@ static void carl9170_usb_tx_data_complete(struct urb *urb)
switch (urb->status) {
/* everything is fine */
case 0:
- carl9170_tx_callback(ar, (void *)urb->context);
+ carl9170_tx_callback(ar, urb->context);
break;

/* disconnect */
@@ -369,7 +369,7 @@ void carl9170_usb_handle_tx_err(struct ar9170 *ar)
struct urb *urb;

while ((urb = usb_get_from_anchor(&ar->tx_err))) {
- struct sk_buff *skb = (void *)urb->context;
+ struct sk_buff *skb = urb->context;

carl9170_tx_drop(ar, skb);
carl9170_tx_callback(ar, skb);
@@ -397,7 +397,7 @@ static void carl9170_usb_tasklet(struct tasklet_struct *t)

static void carl9170_usb_rx_complete(struct urb *urb)
{
- struct ar9170 *ar = (struct ar9170 *)urb->context;
+ struct ar9170 *ar = urb->context;
int err;

if (WARN_ON_ONCE(!ar))
@@ -559,7 +559,7 @@ static int carl9170_usb_flush(struct ar9170 *ar)
int ret, err = 0;

while ((urb = usb_get_from_anchor(&ar->tx_wait))) {
- struct sk_buff *skb = (void *)urb->context;
+ struct sk_buff *skb = urb->context;
carl9170_tx_drop(ar, skb);
carl9170_tx_callback(ar, skb);
usb_free_urb(urb);
@@ -668,7 +668,7 @@ int carl9170_exec_cmd(struct ar9170 *ar, const enum carl9170_cmd_oids cmd,
memcpy(ar->cmd.data, payload, plen);

spin_lock_bh(&ar->cmd_lock);
- ar->readbuf = (u8 *)out;
+ ar->readbuf = out;
ar->readlen = outlen;
spin_unlock_bh(&ar->cmd_lock);

--
2.30.2


2023-09-28 15:34:03

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2 wireless-next 2/9] carl9170: remove unnecessary (void*) conversions

Christian Lamparter <[email protected]> writes:

> On 9/19/23 06:49, Wu Yunchuan wrote:
>> No need cast (void *) to (struct ar9170 *), (u8 *) or (void*).
>
> hmm, your mail went into the spam folder. Good thing I checked.
>
> From what I remember: The reason why these casts were added in
> carl9170 was because of compiler warnings/complaints.
> Current gcc compilers should be OK (given that the kernel-bot
> didn't react, or went your Mail to their spam-folder as well?)
> but have you checked these older versions?

Do you remember anything more about these warnings? I tried to check the
git history and at least quickly couldn't find anything related to this.

The changes look very safe to me, struct urb::context field and the out
variable are both of type 'void *' so removing the explicit casts should
change anything. I cannot really come up a reason why would this patch
cause new warnings so I am inclined towards taking this patch. What do
you think?

--
https://patchwork.kernel.org/project/linux-wireless/list/

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

2023-09-29 18:35:55

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH v2 wireless-next 2/9] carl9170: remove unnecessary (void*) conversions

On 9/29/2023 12:23 AM, Christian Lamparter wrote:
> I would like to take the chance to again point to this beauty:
> <https://lore.kernel.org/linux-wireless/TYAP286MB03154F9AAFD4C35BEEDE4A99BC4CA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM/T/#mf1b8919a000fe661803c17073f48b3c410888541>
> @Dan, @Jeff can you please comment on that too?

I had not seen that patch since it was posted while I was transitioning
roles. It looks like a reasonable patch to me to handle FORTIFY_SOURCE
restrictions.

Can it (any any other ath folder patches) be reposted for review?

/jeff

2023-10-02 17:07:42

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2 wireless-next 2/9] carl9170: remove unnecessary (void*) conversions

Wu Yunchuan <[email protected]> wrote:

> No need cast (void *) to (struct ar9170 *), (u8 *) or (void*).
>
> Signed-off-by: Wu Yunchuan <[email protected]>
> Acked-by: Christian Lamparter <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

Patch applied to ath-next branch of ath.git, thanks.

6c751f1a7bb8 wifi: carl9170: remove unnecessary (void*) conversions

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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