value overwrite in rtq2208-regulator.c: Overwriting previous write to desc->fixed_uV with value from init_data->constraints.min_uV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alina,

In rtq2208-regulator.c I came across this code segment

if (!ret) {
	if (fixed_uV != init_data->constraints.min_uV ||
		fixed_uV != init_data->constraints.max_uV)
		return -EINVAL;
	desc->n_voltages = 1;
	desc->fixed_uV = fixed_uV;
	desc->fixed_uV = init_data->constraints.min_uV;
	desc->ops = &rtq2208_regulator_ldo_fix_ops;
} else {
	desc->n_voltages = ARRAY_SIZE(rtq2208_ldo_volt_table);
	desc->volt_table = rtq2208_ldo_volt_table;
	desc->ops = &rtq2208_regulator_ldo_adj_ops;
}

As you can see we are setting the value of desc->fixed_uV twice. Is this
intentional? Because it looks from commit af1296d15d890 (regulator:
rtq2208: Add fixed LDO VOUT property and check that matches the
constraints) we only need desc->fixed_uV = fixed_uV. Isn't the second
assignment (desc->fixed_uV = init_data->constraints.min_uV) making the
previous one (desc->fixed_uV = fixed_uV) obsolete?

I might be wrong but it seems like it should be something like

--- a/drivers/regulator/rtq2208-regulator.c
+++ b/drivers/regulator/rtq2208-regulator.c
@@ -384,7 +384,6 @@ static int rtq2208_of_get_ldo_dvs_ability(struct device *dev)
 				return -EINVAL;
 			desc->n_voltages = 1;
 			desc->fixed_uV = fixed_uV;
-			desc->fixed_uV = init_data->constraints.min_uV;
 			desc->ops = &rtq2208_regulator_ldo_fix_ops;
 		} else {
 			desc->n_voltages = ARRAY_SIZE(rtq2208_ldo_volt_table);

What do you think? Please feel free to correct me if I'm wrong.

Note: This is my first time communicating on the mailing list, please
excuse if I broken any of the mailing list etiquette.

-- 
Regards,
listout




[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux