31 Dec, 2019

1 commit

  • [ Upstream commit 472b39c3d1bba0616eb0e9a8fa3ad0f56927c7d7 ]

    Inside function max8907_regulator_probe(), variable val could
    be uninitialized if regmap_read() fails. However, val is used
    later in the if statement to decide the content written to
    "pmic", which is potentially unsafe.

    Signed-off-by: Yizhuo
    Link: https://lore.kernel.org/r/20191003175813.16415-1-yzhai003@ucr.edu
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Yizhuo
     

19 Jun, 2019

1 commit

  • Based on 2 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 4122 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

01 Feb, 2017

1 commit

  • Declare regulator_ops structure as const as it is only stored in the ops
    field of a regulator_desc structure. This field is of type const, so
    regulator_ops structures having this property can be made const too.

    File size before: drivers/regulator/max8907-regulator.o
    text data bss dec hex filename
    1384 9424 256 11064 2b38 regulator/max8907-regulator.o

    File size after: drivers/regulator/max8907-regulator.o
    text data bss dec hex filename
    2664 8400 0 11064 2b38 regulator/max8907-regulator.o

    Signed-off-by: Bhumika Goyal
    Signed-off-by: Mark Brown

    Bhumika Goyal
     

20 Oct, 2014

1 commit


10 Sep, 2014

1 commit

  • These of_node_get() were added to balance refcount decrements inside of
    of_find_node_by_name().
    See: commit c92f5dd2c42f ("regulator: Add missing of_node_put()")

    However of_find_node_by_name() was then replaced by of_get_child_by_name(),
    which doesn't call of_node_put() against its input parameter.

    So, need to remove these unnecessary of_node_get() calls.

    Signed-off-by: Guodong Xu
    Reviewed-by: Axel Lin
    Signed-off-by: Mark Brown

    Guodong Xu
     

10 Mar, 2014

1 commit


20 Feb, 2014

1 commit


15 Feb, 2014

1 commit


17 Sep, 2013

1 commit


30 Jan, 2013

1 commit

  • 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: Axel Lin
    Signed-off-by: Mark Brown

    Axel Lin
     

27 Jan, 2013

1 commit

  • 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: Axel Lin
    Reviewed-by: Stephen Warren
    Signed-off-by: Mark Brown

    Axel Lin
     

20 Nov, 2012

3 commits


29 Aug, 2012

6 commits

  • This driver can be built as a module, add MODULE_ALIAS for it.

    Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown

    Axel Lin
     
  • If a regulator is not used by a board, it's quite legitimate not to
    provide platform data or a device tree node to configure it (i.e.
    regulator_init_data). In that case, during MAX8907 regulator's
    probe(), the idata variable will be NULL for that regulator. Prevent
    dereferincing it.

    If the MBATT regulator's init_data is not specified, or no name was
    specified in the constraints, the regulator will be named based on
    the regulator descriptor, so initialize mbatt_rail_name from there.

    Signed-off-by: Stephen Warren
    Signed-off-by: Mark Brown

    Stephen Warren
     
  • Fix the following:

    CC [M] drivers/regulator/max8907-regulator.o
    drivers/regulator/max8907-regulator.c: In function 'max8907_regulator_probe':
    drivers/regulator/max8907-regulator.c:297:12: error: 'max8907_matches' undeclared (first use in this function)

    by removing direct references to max8907_matches[], which only exists when
    CONFIG_OF is defined.

    Signed-off-by: Stephen Warren
    Signed-off-by: Mark Brown

    Stephen Warren
     
  • Add missing platform_get_drvdata() call in max8907_regulator_remove(), this
    fixes below build warning:

    CC [M] drivers/regulator/max8907-regulator.o
    drivers/regulator/max8907-regulator.c: In function 'max8907_regulator_remove':
    drivers/regulator/max8907-regulator.c:353:23: warning: 'pmic' is used uninitialized in this function [-Wuninitialized]

    Signed-off-by: Axel Lin
    Acked-by: Stephen Warren
    Signed-off-by: Mark Brown

    Axel Lin
     
  • For linear voltage mapping, the n_voltages is (max - min) / step + 1

    Signed-off-by: Axel Lin
    Acked-by: Stephen Warren
    Signed-off-by: Mark Brown

    Axel Lin
     
  • The MAX8907 is an I2C-based power-management IC containing voltage
    regulators, a reset controller, a real-time clock, and a touch-screen
    controller.

    The original driver was written by:
    * Gyungoh Yoo

    Various fixes and enhancements by:
    * Jin Park
    * Tom Cherry
    * Prashant Gaikwad
    * Dan Willemsen
    * Laxman Dewangan

    During upstreaming, I (swarren):
    * Converted to regmap.
    * Allowed probing from device tree.
    * Reworked the regulator driver to be represented as a single device that
    provides multiple regulators, rather than as a device per regulator.
    * Replaced many regulator ops with standard functions.
    * Added ability to specify supplies for each regulator.
    * Removed the WLED regulator. If/when we expose this in the driver, it
    should be a backlight object not a regulator object.
    * Renamed from max8907c->max8907, since the driver covers at least the
    C and B revisions.
    * General cleanup.

    Signed-off-by: Gyungoh Yoo
    Signed-off-by: Stephen Warren
    Acked-by: Laxman Dewangan
    Signed-off-by: Mark Brown

    Gyungoh Yoo