LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: Fix cast between incompatible function type
@ 2021-08-01 23:32 Fabio M. De Francesco
2021-08-04 12:49 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Fabio M. De Francesco @ 2021-08-01 23:32 UTC (permalink / raw)
To: Greg Kroah-Hartman, Larry Finger, linux-staging, linux-kernel
Cc: Fabio M. De Francesco
Fix sparse warnings of casts between incompatible function
types from ‘void (*)(void *)’ to ‘void (*)(long unsigned int)’
[-Wcast-function-type].
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 2 +-
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
index 2e3f624d0f22..ef722b4a9ddb 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
@@ -38,7 +38,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
struct recv_buf *precvbuf;
tasklet_init(&precvpriv->recv_tasklet,
- (void(*)(unsigned long))rtl8188eu_recv_tasklet,
+ (void *)rtl8188eu_recv_tasklet,
(unsigned long)padapter);
/* init recv_buf */
diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index e44a01af7f5c..510df3f3e6bd 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -14,7 +14,7 @@ s32 rtl8188eu_init_xmit_priv(struct adapter *adapt)
struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
tasklet_init(&pxmitpriv->xmit_tasklet,
- (void(*)(unsigned long))rtl8188eu_xmit_tasklet,
+ (void *)rtl8188eu_xmit_tasklet,
(unsigned long)adapt);
return _SUCCESS;
}
--
2.32.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: r8188eu: Fix cast between incompatible function type
2021-08-01 23:32 [PATCH] staging: r8188eu: Fix cast between incompatible function type Fabio M. De Francesco
@ 2021-08-04 12:49 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-08-04 12:49 UTC (permalink / raw)
To: Fabio M. De Francesco
Cc: Greg Kroah-Hartman, Larry Finger, linux-staging, linux-kernel
On Mon, Aug 02, 2021 at 01:32:41AM +0200, Fabio M. De Francesco wrote:
> Fix sparse warnings of casts between incompatible function
> types from ‘void (*)(void *)’ to ‘void (*)(long unsigned int)’
> [-Wcast-function-type].
>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> ---
> drivers/staging/r8188eu/hal/rtl8188eu_recv.c | 2 +-
> drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
> index 2e3f624d0f22..ef722b4a9ddb 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188eu_recv.c
> @@ -38,7 +38,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
> struct recv_buf *precvbuf;
>
> tasklet_init(&precvpriv->recv_tasklet,
> - (void(*)(unsigned long))rtl8188eu_recv_tasklet,
> + (void *)rtl8188eu_recv_tasklet,
The correct fix is to change rtl8188eu_recv_tasklet to take an unsigned
long instead of a pointer. Then you can remove the casting entirely.
The rule here is that you should try avoid casting things to a void
pointer.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-04 12:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01 23:32 [PATCH] staging: r8188eu: Fix cast between incompatible function type Fabio M. De Francesco
2021-08-04 12:49 ` Dan Carpenter
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).