Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'regulator-fix-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fix from Mark Brown:
"One fix that came in since -rc1, fixing misuse of a local variable in
the DT parsing code in the RTQ2208 driver"

* tag 'regulator-fix-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
regulator: rtq2208: Fix invalid memory access when devm_of_regulator_put_matches is called

+12 -10
+12 -10
drivers/regulator/rtq2208-regulator.c
··· 228 228 .set_suspend_disable = rtq2208_set_suspend_disable, 229 229 }; 230 230 231 + static struct of_regulator_match rtq2208_ldo_match[] = { 232 + {.name = "ldo2", }, 233 + {.name = "ldo1", }, 234 + }; 235 + 231 236 static unsigned int rtq2208_of_map_mode(unsigned int mode) 232 237 { 233 238 switch (mode) { ··· 327 322 return IRQ_HANDLED; 328 323 } 329 324 330 - static int rtq2208_of_get_fixed_voltage(struct device *dev, 331 - struct of_regulator_match *rtq2208_ldo_match, int n_fixed) 325 + static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) 332 326 { 333 327 struct device_node *np; 334 328 struct of_regulator_match *match; ··· 342 338 if (!np) 343 339 np = dev->of_node; 344 340 345 - ret = of_regulator_match(dev, np, rtq2208_ldo_match, n_fixed); 341 + ret = of_regulator_match(dev, np, rtq2208_ldo_match, ARRAY_SIZE(rtq2208_ldo_match)); 346 342 347 343 of_node_put(np); 348 344 349 345 if (ret < 0) 350 346 return ret; 351 347 352 - for (i = 0; i < n_fixed; i++) { 348 + for (i = 0; i < ARRAY_SIZE(rtq2208_ldo_match); i++) { 353 349 match = rtq2208_ldo_match + i; 354 350 init_data = match->init_data; 355 351 rdesc = (struct rtq2208_regulator_desc *)match->driver_data; ··· 392 388 REGULATOR_LINEAR_RANGE(1310000, 181, 255, 10000), 393 389 }; 394 390 395 - static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, int mtp_sel, 396 - int idx, struct of_regulator_match *rtq2208_ldo_match, int *ldo_idx) 391 + static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, int mtp_sel, int idx) 397 392 { 398 393 struct regulator_desc *desc; 399 394 static const struct { ··· 464 461 static int rtq2208_parse_regulator_dt_data(int n_regulator, const unsigned int *regulator_idx_table, 465 462 struct rtq2208_regulator_desc *rdesc[RTQ2208_LDO_MAX], struct device *dev) 466 463 { 467 - struct of_regulator_match rtq2208_ldo_match[2]; 468 - int mtp_sel, ret, i, idx, ldo_idx = 0; 464 + int mtp_sel, i, idx, ret; 469 465 470 466 /* get mtp_sel0 or mtp_sel1 */ 471 467 mtp_sel = device_property_read_bool(dev, "richtek,mtp-sel-high"); ··· 476 474 if (!rdesc[i]) 477 475 return -ENOMEM; 478 476 479 - rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx, rtq2208_ldo_match, &ldo_idx); 477 + rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx); 480 478 481 479 /* init ldo dvs ability */ 482 480 if (idx >= RTQ2208_LDO2) ··· 484 482 } 485 483 486 484 /* init ldo fixed_uV */ 487 - ret = rtq2208_of_get_fixed_voltage(dev, rtq2208_ldo_match, ldo_idx); 485 + ret = rtq2208_of_get_ldo_dvs_ability(dev); 488 486 if (ret) 489 487 return dev_err_probe(dev, ret, "Failed to get ldo fixed_uV\n"); 490 488