File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -3028,6 +3028,7 @@ static int of_phy_led(struct phy_device *phydev,
3028
3028
struct led_init_data init_data = {};
3029
3029
struct led_classdev * cdev ;
3030
3030
struct phy_led * phyled ;
3031
+ u32 index ;
3031
3032
int err ;
3032
3033
3033
3034
phyled = devm_kzalloc (dev , sizeof (* phyled ), GFP_KERNEL );
@@ -3037,10 +3038,13 @@ static int of_phy_led(struct phy_device *phydev,
3037
3038
cdev = & phyled -> led_cdev ;
3038
3039
phyled -> phydev = phydev ;
3039
3040
3040
- err = of_property_read_u8 (led , "reg" , & phyled -> index );
3041
+ err = of_property_read_u32 (led , "reg" , & index );
3041
3042
if (err )
3042
3043
return err ;
3044
+ if (index > U8_MAX )
3045
+ return - EINVAL ;
3043
3046
3047
+ phyled -> index = index ;
3044
3048
if (phydev -> drv -> led_brightness_set )
3045
3049
cdev -> brightness_set_blocking = phy_led_set_brightness ;
3046
3050
if (phydev -> drv -> led_blink_set )
You can’t perform that action at this time.
0 commit comments