Power Supply Fixes for 4.7 cycle
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCgAGBQJXccbfAAoJENju1/PIO/qaGTAP/1CSF1wshroHh6xLGSINyleH 0fAlwP1We1bM60KMapOQSR/GSsl7w9kwXLkZWHkyN8XQ9AeAaqXM5hGWo0hRkuUY Ae++JpRFgLazD0PactRweC2fSXIrkh/XNm+SLETQvs2JzbjBl3EEyW0RfwjAqGBy VgSRfnvNys+e2WWg5IL+WqqtBSYBPBAW7jtNx7+V1ISD0SPzkSjCaLGjaDzliS+G kcfF1tfbwJG3dpSDBaHZeLO7ipDpQANjfKYIADWH252b/9vhrvgvdy4Tr2lSn7av ISS84obz37oN6wR8z28JKXA4luqE7plv57M6LoBrWl8Nz82uzIpWxQ6Y2eN/JvAt eeJWbhJMgsVUPE5sKB6BE/3ZnZVFg/IQnlQ9u+PhKACHL/5N/A1/aovgLf8nJ8Im N8nO01mw5nEmKYV5b3moZ3oRlbC1NdC5uGa/6TNEoFIHlaKHuySeAmT+qy61iROw dETbzGNyRCfr89srLLETrZu44MAfmw611onkDfgHzdyEpDm6MvNDK0ymZv/si22s Qn3/ibOZFA0WcKaeidpm9knyrkL5DKDY8drqXASt0dAHFXKOKz6znzbUbL+3EvZV nnohnqMuEQpeSQalqtW7G6Fom0dkXvABELDPpumnuxiFFECw1Q6tMUuTLdpuyuFJ 7ddOjKrj4uzJb5ZP7gYV =mUxp -----END PGP SIGNATURE----- Merge tag 'for-v4.7-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply fixes from Sebastian Reichel. * tag 'for-v4.7-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power_supply: tps65217-charger: Fix NULL deref during property export power_supply: power_supply_read_temp only if use_cnt > 0
This commit is contained in:
commit
02184c60eb
|
@ -565,11 +565,12 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd,
|
|||
|
||||
WARN_ON(tzd == NULL);
|
||||
psy = tzd->devdata;
|
||||
ret = psy->desc->get_property(psy, POWER_SUPPLY_PROP_TEMP, &val);
|
||||
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Convert tenths of degree Celsius to milli degree Celsius. */
|
||||
if (!ret)
|
||||
*temp = val.intval * 100;
|
||||
*temp = val.intval * 100;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -612,10 +613,12 @@ static int ps_get_max_charge_cntl_limit(struct thermal_cooling_device *tcd,
|
|||
int ret;
|
||||
|
||||
psy = tcd->devdata;
|
||||
ret = psy->desc->get_property(psy,
|
||||
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val);
|
||||
if (!ret)
|
||||
*state = val.intval;
|
||||
ret = power_supply_get_property(psy,
|
||||
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*state = val.intval;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -628,10 +631,12 @@ static int ps_get_cur_chrage_cntl_limit(struct thermal_cooling_device *tcd,
|
|||
int ret;
|
||||
|
||||
psy = tcd->devdata;
|
||||
ret = psy->desc->get_property(psy,
|
||||
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val);
|
||||
if (!ret)
|
||||
*state = val.intval;
|
||||
ret = power_supply_get_property(psy,
|
||||
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*state = val.intval;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -197,6 +197,7 @@ static int tps65217_charger_probe(struct platform_device *pdev)
|
|||
{
|
||||
struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
|
||||
struct tps65217_charger *charger;
|
||||
struct power_supply_config cfg = {};
|
||||
int ret;
|
||||
|
||||
dev_dbg(&pdev->dev, "%s\n", __func__);
|
||||
|
@ -208,9 +209,12 @@ static int tps65217_charger_probe(struct platform_device *pdev)
|
|||
charger->tps = tps;
|
||||
charger->dev = &pdev->dev;
|
||||
|
||||
cfg.of_node = pdev->dev.of_node;
|
||||
cfg.drv_data = charger;
|
||||
|
||||
charger->ac = devm_power_supply_register(&pdev->dev,
|
||||
&tps65217_charger_desc,
|
||||
NULL);
|
||||
&cfg);
|
||||
if (IS_ERR(charger->ac)) {
|
||||
dev_err(&pdev->dev, "failed: power supply register\n");
|
||||
return PTR_ERR(charger->ac);
|
||||
|
|
Loading…
Reference in New Issue