* [PATCH] platform/x86/amd/pmf: Return a status code only as a constant in two functions
@ 2023-12-28 9:54 Markus Elfring
2024-01-02 12:38 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2023-12-28 9:54 UTC (permalink / raw)
To: platform-driver-x86, kernel-janitors, Hans de Goede,
Ilpo Järvinen, Shyam Sundar S K
Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 28 Dec 2023 10:48:16 +0100
Return a status code without storing it in an intermediate variable.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/platform/x86/amd/pmf/acpi.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c
index 4ec7957eb707..ce00dd9a5391 100644
--- a/drivers/platform/x86/amd/pmf/acpi.c
+++ b/drivers/platform/x86/amd/pmf/acpi.c
@@ -111,7 +111,6 @@ int apmf_os_power_slider_update(struct amd_pmf_dev *pdev, u8 event)
struct os_power_slider args;
struct acpi_buffer params;
union acpi_object *info;
- int err = 0;
args.size = sizeof(args);
args.slider_event = event;
@@ -121,10 +120,10 @@ int apmf_os_power_slider_update(struct amd_pmf_dev *pdev, u8 event)
info = apmf_if_call(pdev, APMF_FUNC_OS_POWER_SLIDER_UPDATE, ¶ms);
if (!info)
- err = -EIO;
+ return -EIO;
kfree(info);
- return err;
+ return 0;
}
static void apmf_sbios_heartbeat_notify(struct work_struct *work)
@@ -148,7 +147,6 @@ int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx)
union acpi_object *info;
struct apmf_fan_idx args;
struct acpi_buffer params;
- int err = 0;
args.size = sizeof(args);
args.fan_ctl_mode = manual;
@@ -158,14 +156,11 @@ int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx)
params.pointer = (void *)&args;
info = apmf_if_call(pdev, APMF_FUNC_SET_FAN_IDX, ¶ms);
- if (!info) {
- err = -EIO;
- goto out;
- }
+ if (!info)
+ return -EIO;
-out:
kfree(info);
- return err;
+ return 0;
}
int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode *data)
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86/amd/pmf: Return a status code only as a constant in two functions
2023-12-28 9:54 [PATCH] platform/x86/amd/pmf: Return a status code only as a constant in two functions Markus Elfring
@ 2024-01-02 12:38 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2024-01-02 12:38 UTC (permalink / raw)
To: Markus Elfring, platform-driver-x86, kernel-janitors,
Ilpo Järvinen, Shyam Sundar S K
Cc: LKML
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
Hi,
On 12/28/23 10:54, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 28 Dec 2023 10:48:16 +0100
>
> Return a status code without storing it in an intermediate variable.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/platform/x86/amd/pmf/acpi.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c
> index 4ec7957eb707..ce00dd9a5391 100644
> --- a/drivers/platform/x86/amd/pmf/acpi.c
> +++ b/drivers/platform/x86/amd/pmf/acpi.c
> @@ -111,7 +111,6 @@ int apmf_os_power_slider_update(struct amd_pmf_dev *pdev, u8 event)
> struct os_power_slider args;
> struct acpi_buffer params;
> union acpi_object *info;
> - int err = 0;
>
> args.size = sizeof(args);
> args.slider_event = event;
> @@ -121,10 +120,10 @@ int apmf_os_power_slider_update(struct amd_pmf_dev *pdev, u8 event)
>
> info = apmf_if_call(pdev, APMF_FUNC_OS_POWER_SLIDER_UPDATE, ¶ms);
> if (!info)
> - err = -EIO;
> + return -EIO;
>
> kfree(info);
> - return err;
> + return 0;
> }
>
> static void apmf_sbios_heartbeat_notify(struct work_struct *work)
> @@ -148,7 +147,6 @@ int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx)
> union acpi_object *info;
> struct apmf_fan_idx args;
> struct acpi_buffer params;
> - int err = 0;
>
> args.size = sizeof(args);
> args.fan_ctl_mode = manual;
> @@ -158,14 +156,11 @@ int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx)
> params.pointer = (void *)&args;
>
> info = apmf_if_call(pdev, APMF_FUNC_SET_FAN_IDX, ¶ms);
> - if (!info) {
> - err = -EIO;
> - goto out;
> - }
> + if (!info)
> + return -EIO;
>
> -out:
> kfree(info);
> - return err;
> + return 0;
> }
>
> int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode *data)
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-02 12:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-28 9:54 [PATCH] platform/x86/amd/pmf: Return a status code only as a constant in two functions Markus Elfring
2024-01-02 12:38 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®