lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231103144311.000008f1@Huawei.com>
Date:   Fri, 3 Nov 2023 14:43:11 +0000
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Andrew Jeffery <andrew@...econstruct.com.au>
CC:     <minyard@....org>, <openipmi-developer@...ts.sourceforge.net>,
        <linux-kernel@...r.kernel.org>, <aladyshev22@...il.com>,
        <jk@...econstruct.com.au>
Subject: Re: [PATCH 04/10] ipmi: kcs_bmc: Make remove_device() callback
 return void

On Fri,  3 Nov 2023 16:45:16 +1030
Andrew Jeffery <andrew@...econstruct.com.au> wrote:

> Don't pretend there's a valid failure path when there's not.
> 
> Signed-off-by: Andrew Jeffery <andrew@...econstruct.com.au>

Whilst I agree returning an error code is pointless, it is perhaps
useful to make sure there is a dev_err() or similar in the paths
now that you've remove the one at the call site.

Minor point and up to you if you want to or not.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>


> ---
>  drivers/char/ipmi/kcs_bmc.c           | 12 ++----------
>  drivers/char/ipmi/kcs_bmc_cdev_ipmi.c |  6 ++----
>  drivers/char/ipmi/kcs_bmc_client.h    |  2 +-
>  drivers/char/ipmi/kcs_bmc_serio.c     |  6 ++----
>  4 files changed, 7 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c
> index 1a827db8a465..5a3f199241d2 100644
> --- a/drivers/char/ipmi/kcs_bmc.c
> +++ b/drivers/char/ipmi/kcs_bmc.c
> @@ -135,15 +135,11 @@ EXPORT_SYMBOL(kcs_bmc_add_device);
>  void kcs_bmc_remove_device(struct kcs_bmc_device *kcs_bmc)
>  {
>  	struct kcs_bmc_driver *drv;
> -	int rc;
>  
>  	mutex_lock(&kcs_bmc_lock);
>  	list_del(&kcs_bmc->entry);
>  	list_for_each_entry(drv, &kcs_bmc_drivers, entry) {
> -		rc = drv->ops->remove_device(kcs_bmc);
> -		if (rc)
> -			dev_err(kcs_bmc->dev, "Failed to remove chardev for KCS channel %d: %d",
> -				kcs_bmc->channel, rc);
> +		drv->ops->remove_device(kcs_bmc);
>  	}
>  	mutex_unlock(&kcs_bmc_lock);
>  }
> @@ -169,15 +165,11 @@ EXPORT_SYMBOL(kcs_bmc_register_driver);
>  void kcs_bmc_unregister_driver(struct kcs_bmc_driver *drv)
>  {
>  	struct kcs_bmc_device *kcs_bmc;
> -	int rc;
>  
>  	mutex_lock(&kcs_bmc_lock);
>  	list_del(&drv->entry);
>  	list_for_each_entry(kcs_bmc, &kcs_bmc_devices, entry) {
> -		rc = drv->ops->remove_device(kcs_bmc);
> -		if (rc)
> -			dev_err(kcs_bmc->dev, "Failed to remove driver for KCS channel %d: %d",
> -				kcs_bmc->channel, rc);
> +		drv->ops->remove_device(kcs_bmc);
>  	}
>  	mutex_unlock(&kcs_bmc_lock);
>  }
> diff --git a/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c b/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c
> index cf670e891966..0552a07d6775 100644
> --- a/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c
> +++ b/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c
> @@ -512,7 +512,7 @@ static int kcs_bmc_ipmi_add_device(struct kcs_bmc_device *kcs_bmc)
>  	return 0;
>  }
>  
> -static int kcs_bmc_ipmi_remove_device(struct kcs_bmc_device *kcs_bmc)
> +static void kcs_bmc_ipmi_remove_device(struct kcs_bmc_device *kcs_bmc)
>  {
>  	struct kcs_bmc_ipmi *priv = NULL, *pos;
>  
> @@ -527,7 +527,7 @@ static int kcs_bmc_ipmi_remove_device(struct kcs_bmc_device *kcs_bmc)
>  	spin_unlock_irq(&kcs_bmc_ipmi_instances_lock);
>  
>  	if (!priv)
> -		return -ENODEV;
> +		return;
>  
>  	misc_deregister(&priv->miscdev);
>  	kcs_bmc_disable_device(priv->client.dev, &priv->client);
> @@ -535,8 +535,6 @@ static int kcs_bmc_ipmi_remove_device(struct kcs_bmc_device *kcs_bmc)
>  	devm_kfree(kcs_bmc->dev, priv->data_out);
>  	devm_kfree(kcs_bmc->dev, priv->data_in);
>  	devm_kfree(kcs_bmc->dev, priv);
> -
> -	return 0;
>  }
>  
>  static const struct kcs_bmc_driver_ops kcs_bmc_ipmi_driver_ops = {
> diff --git a/drivers/char/ipmi/kcs_bmc_client.h b/drivers/char/ipmi/kcs_bmc_client.h
> index 814ad8e052ef..1c0df184860d 100644
> --- a/drivers/char/ipmi/kcs_bmc_client.h
> +++ b/drivers/char/ipmi/kcs_bmc_client.h
> @@ -10,7 +10,7 @@
>  
>  struct kcs_bmc_driver_ops {
>  	int (*add_device)(struct kcs_bmc_device *kcs_bmc);
> -	int (*remove_device)(struct kcs_bmc_device *kcs_bmc);
> +	void (*remove_device)(struct kcs_bmc_device *kcs_bmc);
>  };
>  
>  struct kcs_bmc_driver {
> diff --git a/drivers/char/ipmi/kcs_bmc_serio.c b/drivers/char/ipmi/kcs_bmc_serio.c
> index 1793358be782..0320ea974e03 100644
> --- a/drivers/char/ipmi/kcs_bmc_serio.c
> +++ b/drivers/char/ipmi/kcs_bmc_serio.c
> @@ -103,7 +103,7 @@ static int kcs_bmc_serio_add_device(struct kcs_bmc_device *kcs_bmc)
>  	return 0;
>  }
>  
> -static int kcs_bmc_serio_remove_device(struct kcs_bmc_device *kcs_bmc)
> +static void kcs_bmc_serio_remove_device(struct kcs_bmc_device *kcs_bmc)
>  {
>  	struct kcs_bmc_serio *priv = NULL, *pos;
>  
> @@ -118,7 +118,7 @@ static int kcs_bmc_serio_remove_device(struct kcs_bmc_device *kcs_bmc)
>  	spin_unlock_irq(&kcs_bmc_serio_instances_lock);
>  
>  	if (!priv)
> -		return -ENODEV;
> +		return;
>  
>  	/* kfree()s priv->port via put_device() */
>  	serio_unregister_port(priv->port);
> @@ -127,8 +127,6 @@ static int kcs_bmc_serio_remove_device(struct kcs_bmc_device *kcs_bmc)
>  	kcs_bmc_disable_device(kcs_bmc, &priv->client);
>  
>  	devm_kfree(priv->client.dev->dev, priv);
> -
> -	return 0;
>  }
>  
>  static const struct kcs_bmc_driver_ops kcs_bmc_serio_driver_ops = {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ