diff mbox series

HID: rmi: fix devm_add_action_or_reset() parameter

Message ID 1555073657-24386-1-git-send-email-fabien.dessenne@st.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show
Series HID: rmi: fix devm_add_action_or_reset() parameter | expand

Commit Message

Fabien DESSENNE April 12, 2019, 12:54 p.m. UTC
The second parameter of devm_add_action_or_reset() shall be a function,
not a function address.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/hid/hid-rmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Kosina May 3, 2019, 12:19 p.m. UTC | #1
On Fri, 12 Apr 2019, Fabien Dessenne wrote:

> The second parameter of devm_add_action_or_reset() shall be a function,
> not a function address.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>  drivers/hid/hid-rmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 9e33165..8748d4d 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -623,7 +623,7 @@ static int rmi_setup_irq_domain(struct hid_device *hdev)
>  	if (!hdata->domain)
>  		return -ENOMEM;
>  
> -	ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata);
> +	ret = devm_add_action_or_reset(&hdev->dev, rmi_irq_teardown, hdata);

Why do you think this is wrong C?
Fabien DESSENNE May 3, 2019, 12:38 p.m. UTC | #2
On 03/05/2019 2:19 PM, Jiri Kosina wrote:
> On Fri, 12 Apr 2019, Fabien Dessenne wrote:
>
>> The second parameter of devm_add_action_or_reset() shall be a function,
>> not a function address.
>>
>> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
>> ---
>>   drivers/hid/hid-rmi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
>> index 9e33165..8748d4d 100644
>> --- a/drivers/hid/hid-rmi.c
>> +++ b/drivers/hid/hid-rmi.c
>> @@ -623,7 +623,7 @@ static int rmi_setup_irq_domain(struct hid_device *hdev)
>>   	if (!hdata->domain)
>>   		return -ENOMEM;
>>   
>> -	ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata);
>> +	ret = devm_add_action_or_reset(&hdev->dev, rmi_irq_teardown, hdata);
> Why do you think this is wrong C?


Because I was not aware that both func and &func refer to the same 
function pointer.

Now I know :)


>
Jiri Kosina May 3, 2019, 12:42 p.m. UTC | #3
On Fri, 3 May 2019, Fabien DESSENNE wrote:

> >> -	ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata);
> >> +	ret = devm_add_action_or_reset(&hdev->dev, rmi_irq_teardown, hdata);
> > Why do you think this is wrong C?
> 
> Because I was not aware that both func and &func refer to the same 
> function pointer.
> 
> Now I know :)

Yup, it's defined in 6.3.2.1.4 in C99.
diff mbox series

Patch

diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 9e33165..8748d4d 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -623,7 +623,7 @@  static int rmi_setup_irq_domain(struct hid_device *hdev)
 	if (!hdata->domain)
 		return -ENOMEM;
 
-	ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata);
+	ret = devm_add_action_or_reset(&hdev->dev, rmi_irq_teardown, hdata);
 	if (ret)
 		return ret;