1. 15 2月, 2013 1 次提交
    • R
      regulator: Fix memory garbage dev_err printout. · 9c7b4e8a
      Russ Dill 提交于
      commit dd8004af: 'regulator: core: Log when a device causes a voltage
      constraint fail', tried to print out some information about the
      check consumer min/max uV fixup, however, it uses a garbage pointer
      left over from list_for_each_entry leading to boot messages in the
      form:
      
      '[    2.079890] <RANDOM ASCII>: Restricting voltage, 3735899821-4294967295uV'
      
      Because it references regulator->dev, it could potentially read memory from
      anywhere causing a panic.
      
      This patch instead uses rdev and the updated min/max uV values.
      Signed-off-by: NRuss Dill <Russ.Dill@ti.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      9c7b4e8a
  2. 14 2月, 2013 1 次提交
  3. 13 2月, 2013 1 次提交
  4. 08 2月, 2013 3 次提交
  5. 05 2月, 2013 1 次提交
  6. 31 1月, 2013 4 次提交
  7. 30 1月, 2013 2 次提交
    • A
      regulator: Add missing of_node_put() · c92f5dd2
      Axel Lin 提交于
      of_find_node_by_name() returns a node pointer with refcount incremented, use
      of_node_put() on it when done.
      
      of_find_node_by_name() will call of_node_put() against from parameter,
      thus we also need to call of_node_get(from) before calling
      of_find_node_by_name().
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      c92f5dd2
    • S
      regulator: clear state each invocation of of_regulator_match · a2f95c36
      Stephen Warren 提交于
      of_regulator_match() saves some dynamcially allocated state into the
      match table that's passed to it. By implementation and not contract, for
      each match table entry, if non-NULL state is already present,
      of_regulator_match() will not overwrite it. of_regulator_match() is
      typically called each time a regulator is probe()d. This means it is
      called with the same match table over and over again if a regulator
      triggers deferred probe. This results in stale, kfree()d data being left
      in the match table from probe to probe, which causes a variety of crashes
      or use of invalid data.
      
      Explicitly free all output state from of_regulator_match() before
      generating new results in order to avoid this.
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Cc: stable@vger.kernel.org
      a2f95c36
  8. 29 1月, 2013 2 次提交
  9. 27 1月, 2013 6 次提交
    • M
      regulator: mc13892: sanity check num_regulators parsed vs. registered · 2c8a5dca
      Matt Sealey 提交于
      Imagine a situation where a device tree has a few regulators in an
      appropriate node:
      
      regulators {
      	sw1 {
      		..
      	};
      
      	vvideo {
      		..
      	};
      
      	:
      
      	vfake {
      		..
      	};
      
      	vtypo {
      		..
      	};
      };
      
      In the above example, the node name "vfake" is an attempt to match a
      regulator name inside the driver which just so happens to not exist. The
      node name "vtypo" represents an accidental typographical error in a
      regulator name which may have been introduced to a device tree.
      
      In these cases, the number of regulators the mc13892 driver thinks it has
      does not match the number of regulators it parsed and registered. Since
      it will go over this array based on this number, it will actually
      re-register regulator "0" (which happens to be SW1) over and over
      again until it reaches the number, resulting in messages on the kernel
      log such as these:
      
      SW1: at 1100 mV
      VVIDEO: at 2775mV
      :
      SW1: at 1100 mV
      SW1: at 1100 mV
      
      .. up to that number of "mismatched" regulators. Nobody using DT can/will
      consume these regulators, so it should not be possible for it to cause any
      real regulator problems or driver breakages, but it is an easy thing to
      miss in a kernel log and is an immediate indication of a problem with the
      device tree authoring.
      
      This patch effectively sanity checks the number of counted children of
      the regulators node vs. the number that actually matched driver names,
      and sets the appropriate num_regulators value. It also gives a little
      warning for device tree authors that they MAY have screwed something up,
      such that this patch does not hide the device tree authoring problem.
      Signed-off-by: NMatt Sealey <matt@genesi-usa.com>
      Tested-by: NSteev Klimaszewski <steev@genesi-usa.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      2c8a5dca
    • M
      regulator: mc13892-regulator: correct/refine handling of the SWxHI bit · ccf3ed78
      Matt Sealey 提交于
      MC13892 PMIC supports a "HI" bit for 3 of it's 4 buck switcher outputs,
      which enables a higher set of voltage ranges.
      
      Despite a comment in the code ('sw regulators need special care due to the
      "hi" bit'), it actually does not take special care since it does not modify
      it's use of the selector table index when this bit is set, giving us very
      odd behavior when setting a high voltage on supported switchers or listing
      current voltages. Net effect is in best case the kernel and sysfs report
      lower voltages than are actually set in hardware (1300mV instead of 1800mV
      for example) and in the worst case setting a voltage (e.g. 1800mV) will cause
      an undervoltage condition (e.g. 1300mV).
      
      Correct the behavior, taking into account SW1 doesn't support the HI bit,
      and as such we need to ignore it.
      
      While we are modifying these functions, fix and optimize the following;
      
      * set_voltage_sel callback was using .reg instead of .vsel_reg - since
        they were set to the same value it actually didn't break anything but
        it would be semantically incorrect to use .reg in this case. We now use
        .vsel_reg and be consistent.
      * vsel_shift is always 0 for every SWx regulator, and constantly shifting
        and masking off the bottom few bits is time consuming and makes the
        code very hard to read - optimize this out.
      * get_voltage_sel uses the variable "val" and set_voltage_sel uses the
        variable "selector" (and reg_value). Introduce the variable "selector"
        to get_voltage_sel such that it makes more sense and allow some leaner
        code in light of the modifications in this patch. Add better exposure
        to the debug print so the register value AND the selector are printed as
        this will adequately show the HI bit in the register.
      * correct a comment in probe which is doing a version check. Magic
        values are awful but for once instance, a comment does just as
        good a job as something symbolic.
      Signed-off-by: NMatt Sealey <matt@genesi-usa.com>
      Tested-by: NSteev Klimaszewski <steev@genesi-usa.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      ccf3ed78
    • A
    • A
      regulator: max8997: Fix using wrong dev argument at various places · b4895e2c
      Axel Lin 提交于
      Use &pdev->dev rather than iodev->dev for dev_err(), dev_warn() and dev_info().
      Use &pdev->dev rather than iodev->dev for devm_kzalloc() and
      of_get_regulator_init_data(), this fixes memory leak.
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      b4895e2c
    • A
      regulator: max77686: Fix using wrong dev argument at various places · b19f5758
      Axel Lin 提交于
      Use &pdev->dev rather than iodev->dev for dev_err().
      Use &pdev->dev rather than iodev->dev for devm_kzalloc() and
      of_regulator_match(), this fixes memory leak.
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      b19f5758
    • A
      regulator: max8907: Fix using wrong dev argument for calling of_regulator_match · f40cbcb9
      Axel Lin 提交于
      The dev parameter is the device requesting the data.
      In this case it should be &pdev->dev rather than pdev->dev.parent.
      
      The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
      which means this fixes a memory leak because the memory is allocated every time
      probe() is called, thus it should be freed when this driver is unloaded.
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Reviewed-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      f40cbcb9
  10. 26 1月, 2013 3 次提交
  11. 24 1月, 2013 2 次提交
  12. 17 1月, 2013 3 次提交
  13. 13 1月, 2013 2 次提交
  14. 10 1月, 2013 2 次提交
  15. 08 1月, 2013 5 次提交
  16. 07 1月, 2013 2 次提交