Re: [RFT PATCH] power: bq2415x_charger: Properly handle ENODEV from power_supply_get_by_phandle

2014-10-15 Thread Krzysztof Kozlowski
On śro, 2014-10-15 at 15:58 +0200, Sebastian Reichel wrote: > Hi, > > On Wed, Oct 15, 2014 at 01:11:31PM +0200, Krzysztof Kozlowski wrote: > > > [...] I guess something as the following is needed: > > > > > > if (IS_ERR_OR_NULL(bq->notify_psy)) { > > > if (bq->notify_psy) > > > dev_er

Re: [RFT PATCH] power: bq2415x_charger: Properly handle ENODEV from power_supply_get_by_phandle

2014-10-15 Thread Sebastian Reichel
Hi, On Wed, Oct 15, 2014 at 01:11:31PM +0200, Krzysztof Kozlowski wrote: > > [...] I guess something as the following is needed: > > > > if (IS_ERR_OR_NULL(bq->notify_psy)) { > > if (bq->notify_psy) > > dev_err(&client->dev, "no 'ti,usb-charger-detection' property\n"); > > ret = P

Re: [RFT PATCH] power: bq2415x_charger: Properly handle ENODEV from power_supply_get_by_phandle

2014-10-15 Thread Krzysztof Kozlowski
On śro, 2014-10-15 at 11:05 +0200, Sebastian Reichel wrote: > Hi Krzysztof, > > On Tue, Oct 14, 2014 at 10:32:53AM +0200, Krzysztof Kozlowski wrote: > > The power_supply_get_by_phandle() on error returns ENODEV or NULL. > > The driver later expects obtained pointer to power supply to be > > valid

Re: [RFT PATCH] power: bq2415x_charger: Properly handle ENODEV from power_supply_get_by_phandle

2014-10-15 Thread Sebastian Reichel
Hi Krzysztof, On Tue, Oct 14, 2014 at 10:32:53AM +0200, Krzysztof Kozlowski wrote: > The power_supply_get_by_phandle() on error returns ENODEV or NULL. > The driver later expects obtained pointer to power supply to be > valid or NULL. If it is not NULL then it dereferences it in > bq2415x_notifier

[RFT PATCH] power: bq2415x_charger: Properly handle ENODEV from power_supply_get_by_phandle

2014-10-14 Thread Krzysztof Kozlowski
The power_supply_get_by_phandle() on error returns ENODEV or NULL. The driver later expects obtained pointer to power supply to be valid or NULL. If it is not NULL then it dereferences it in bq2415x_notifier_call() which would lead to dereferencing ENODEV-value pointer. Properly handle the power_s