[4/4] power: supply: core: Constify properties
diff mbox series

Message ID 20200413183853.1088823-5-sebastian.reichel@collabora.com
State New
Headers show
Series
  • Add support for constant power-supply property tables
Related show

Commit Message

Sebastian Reichel April 13, 2020, 6:38 p.m. UTC
properties is a list of properties supported by the
driver. It is not modified by the power-supply core
and drivers are not supposed to change it once the
list has been registered. Let's mark it as const for
improved security.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 include/linux/power_supply.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Enric Balletbo i Serra April 14, 2020, 3:57 p.m. UTC | #1
Hi Sebastian,

On 13/4/20 20:38, Sebastian Reichel wrote:
> properties is a list of properties supported by the
> driver. It is not modified by the power-supply core
> and drivers are not supposed to change it once the
> list has been registered. Let's mark it as const for
> improved security.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

> ---
>  include/linux/power_supply.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 0392c9cc8f1c..6a34df65d4d1 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -225,7 +225,7 @@ struct power_supply_desc {
>  	enum power_supply_type type;
>  	const enum power_supply_usb_type *usb_types;
>  	size_t num_usb_types;
> -	enum power_supply_property *properties;
> +	const enum power_supply_property *properties;
>  	size_t num_properties;
>  
>  	/*
>

Patch
diff mbox series

diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 0392c9cc8f1c..6a34df65d4d1 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -225,7 +225,7 @@  struct power_supply_desc {
 	enum power_supply_type type;
 	const enum power_supply_usb_type *usb_types;
 	size_t num_usb_types;
-	enum power_supply_property *properties;
+	const enum power_supply_property *properties;
 	size_t num_properties;
 
 	/*