greybus: use PTR_ERR_OR_ZERO()

Coccinelle points out that the macro PTR_ERR_OR_ZERO() handles the
frequent case of converting a pointer into either error code (if its
value is an encoded error value) or 0 (otherwise).  Switch some code
in gb_power_supply_register() to use that macro.  I have verified
this is true of the kernel we're now working with (arche-6.0).

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Alex Elder 2016-05-24 13:34:51 -05:00 коммит произвёл Greg Kroah-Hartman
Родитель d97fca12e9
Коммит 95073cc2e5
1 изменённых файлов: 1 добавлений и 4 удалений

Просмотреть файл

@ -547,10 +547,7 @@ static int gb_power_supply_register(struct gb_power_supply *gbpsy)
gbpsy->psy = power_supply_register(&connection->bundle->dev, gbpsy->psy = power_supply_register(&connection->bundle->dev,
&gbpsy->desc, &cfg); &gbpsy->desc, &cfg);
if (IS_ERR(gbpsy->psy)) return PTR_ERR_OR_ZERO(gbpsy->psy);
return PTR_ERR(gbpsy->psy);
return 0;
} }
#endif #endif