History

Merge tag 'hwmon-for-v6.8-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmonfix from Guenter Roeck: "Fix crash seen when instantiating npcm750-pwm-fan" * tag 'hwmon-for-v6.8-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (npcm750-pwm-fan) Fix crash observed when instantiating nuvoton,npcm750-pwm-fan

Linus Torvalds committed 2 years ago

Commit da3c45c2 parents db5ccb9 2539b151 file · +5 −2Browse files

Unified · Split

drivers/hwmon/npcm750-pwm-fan.c+5−2
@@ -195,6 +195,7 @@ struct npcm7xx_cooling_device { · 194 unmodified lines
195struct npcm7xx_pwm_fan_data {195struct npcm7xx_pwm_fan_data {
196 void __iomem *pwm_base;196 void __iomem *pwm_base;
197 void __iomem *fan_base;197 void __iomem *fan_base;
198 int pwm_modules;
198 unsigned long pwm_clk_freq;199 unsigned long pwm_clk_freq;
199 unsigned long fan_clk_freq;200 unsigned long fan_clk_freq;
200 struct clk *pwm_clk;201 struct clk *pwm_clk;
@@ -710,7 +711,7 @@ static u32 npcm7xx_pwm_init(struct npcm7xx_pwm_fan_data *data) · 509 unmodified lines
710 /* Setting PWM Prescale Register value register to both modules */711 /* Setting PWM Prescale Register value register to both modules */
711 prescale_val |= (prescale_val << NPCM7XX_PWM_PRESCALE_SHIFT_CH01);712 prescale_val |= (prescale_val << NPCM7XX_PWM_PRESCALE_SHIFT_CH01);
712 713
713 for (m = 0; m < NPCM7XX_PWM_MAX_MODULES ; m++) {714 for (m = 0; m < data->pwm_modules; m++) {
714 iowrite32(prescale_val, NPCM7XX_PWM_REG_PR(data->pwm_base, m));715 iowrite32(prescale_val, NPCM7XX_PWM_REG_PR(data->pwm_base, m));
715 iowrite32(NPCM7XX_PWM_PRESCALE2_DEFAULT,716 iowrite32(NPCM7XX_PWM_PRESCALE2_DEFAULT,
716 NPCM7XX_PWM_REG_CSR(data->pwm_base, m));717 NPCM7XX_PWM_REG_CSR(data->pwm_base, m));
@@ -946,6 +947,8 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) · 229 unmodified lines
946 if (!data->info)947 if (!data->info)
947 return -EINVAL;948 return -EINVAL;
948 949
950 data->pwm_modules = data->info->pwm_max_channel / NPCM7XX_PWM_MAX_CHN_NUM_IN_A_MODULE;
951
949 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm");952 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm");
950 if (!res) {953 if (!res) {
951 dev_err(dev, "pwm resource not found\n");954 dev_err(dev, "pwm resource not found\n");
@@ -983,7 +986,7 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) · 31 unmodified lines
983 output_freq = npcm7xx_pwm_init(data);986 output_freq = npcm7xx_pwm_init(data);
984 npcm7xx_fan_init(data);987 npcm7xx_fan_init(data);
985 988
986 for (cnt = 0; cnt < NPCM7XX_PWM_MAX_MODULES ; cnt++)989 for (cnt = 0; cnt < data->pwm_modules; cnt++)
987 mutex_init(&data->pwm_lock[cnt]);990 mutex_init(&data->pwm_lock[cnt]);
988 991
989 for (i = 0; i < NPCM7XX_FAN_MAX_MODULE; i++) {992 for (i = 0; i < NPCM7XX_FAN_MAX_MODULE; i++) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t