power: supply: fix null pointer check order in __power_supply_register
authorqinyu <qinyu32@huawei.com>
Thu, 23 Feb 2023 08:10:47 +0000 (16:10 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sat, 25 Feb 2023 00:15:03 +0000 (01:15 +0100)
commitbfaecf465a058b167abc7c0dfad985f167ff3af1
tree32a246972c50af20ef073ad4ad056a42adf2e538
parentc142872ea40a99258e2a86bf5c471bcc81752f56
power: supply: fix null pointer check order in __power_supply_register

There is an null pointer check order issue here: if we have to
check !desc and !desc->name anyway, check it before dereferencing it in
pr_warn().

Signed-off-by: qinyu <qinyu32@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_core.c