* [PATCH][next] platform/x86: hp: hp-bioscfg: remove redundant if statement
@ 2024-11-07 11:35 Colin Ian King
2024-11-07 11:39 ` Hans de Goede
2024-11-12 17:17 ` Ilpo Järvinen
0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2024-11-07 11:35 UTC (permalink / raw)
To: Jorge Lopez, Hans de Goede, Ilpo Järvinen,
platform-driver-x86
Cc: kernel-janitors, linux-kernel
The if statement performs the same action if the strcmp result is
true or false since there is identical code on both branches. The
if statement is redundant and can be replaced with just one call
to sysfs_remove_group.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
.../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
index 35936c05e45b..187b372123ed 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
@@ -531,14 +531,9 @@ void hp_exit_password_attributes(void)
struct kobject *attr_name_kobj =
bioscfg_drv.password_data[instance_id].attr_name_kobj;
- if (attr_name_kobj) {
- if (!strcmp(attr_name_kobj->name, SETUP_PASSWD))
- sysfs_remove_group(attr_name_kobj,
- &password_attr_group);
- else
- sysfs_remove_group(attr_name_kobj,
- &password_attr_group);
- }
+ if (attr_name_kobj)
+ sysfs_remove_group(attr_name_kobj,
+ &password_attr_group);
}
bioscfg_drv.password_instances_count = 0;
kfree(bioscfg_drv.password_data);
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] platform/x86: hp: hp-bioscfg: remove redundant if statement
2024-11-07 11:35 [PATCH][next] platform/x86: hp: hp-bioscfg: remove redundant if statement Colin Ian King
@ 2024-11-07 11:39 ` Hans de Goede
2024-11-12 17:17 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2024-11-07 11:39 UTC (permalink / raw)
To: Colin Ian King, Jorge Lopez, Ilpo Järvinen,
platform-driver-x86
Cc: kernel-janitors, linux-kernel
Hi,
On 7-Nov-24 12:35 PM, Colin Ian King wrote:
> The if statement performs the same action if the strcmp result is
> true or false since there is identical code on both branches. The
> if statement is redundant and can be replaced with just one call
> to sysfs_remove_group.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> .../platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
> index 35936c05e45b..187b372123ed 100644
> --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
> +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
> @@ -531,14 +531,9 @@ void hp_exit_password_attributes(void)
> struct kobject *attr_name_kobj =
> bioscfg_drv.password_data[instance_id].attr_name_kobj;
>
> - if (attr_name_kobj) {
> - if (!strcmp(attr_name_kobj->name, SETUP_PASSWD))
> - sysfs_remove_group(attr_name_kobj,
> - &password_attr_group);
> - else
> - sysfs_remove_group(attr_name_kobj,
> - &password_attr_group);
> - }
> + if (attr_name_kobj)
> + sysfs_remove_group(attr_name_kobj,
> + &password_attr_group);
> }
> bioscfg_drv.password_instances_count = 0;
> kfree(bioscfg_drv.password_data);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] platform/x86: hp: hp-bioscfg: remove redundant if statement
2024-11-07 11:35 [PATCH][next] platform/x86: hp: hp-bioscfg: remove redundant if statement Colin Ian King
2024-11-07 11:39 ` Hans de Goede
@ 2024-11-12 17:17 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2024-11-12 17:17 UTC (permalink / raw)
To: Jorge Lopez, Hans de Goede, platform-driver-x86, Colin Ian King
Cc: kernel-janitors, linux-kernel
On Thu, 07 Nov 2024 11:35:43 +0000, Colin Ian King wrote:
> The if statement performs the same action if the strcmp result is
> true or false since there is identical code on both branches. The
> if statement is redundant and can be replaced with just one call
> to sysfs_remove_group.
>
>
Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: hp: hp-bioscfg: remove redundant if statement
commit: 4ceb681f1822819f78b747ddc189479fead43be2
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-12 17:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 11:35 [PATCH][next] platform/x86: hp: hp-bioscfg: remove redundant if statement Colin Ian King
2024-11-07 11:39 ` Hans de Goede
2024-11-12 17:17 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox