kernel: fix bugs added with mac-address-ascii support
authorRafał Miłecki <rafal@milecki.pl>
Thu, 5 Jan 2023 12:33:18 +0000 (13:33 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Sat, 7 Jan 2023 11:02:30 +0000 (12:02 +0100)
commita1abf71827834345219adc8e2a361ef2faa0d1bc
tree29528187c6343ba3c51ff6a983b3f3fea43af11f
parent7c574525eef49f56f9e9880a1584b3f8d12bcf60
kernel: fix bugs added with mac-address-ascii support

1. Check for -EPROBE_DEFER
If it occurs we have to return immediately. Trying other properties
could result in another error and ignoring -EPROBE_DEFER which has a
special meaning.

2. Check for read result
Assuming property->read() success can result in NULL pointer
dereference. It happens e.g. for "mac-address" with NVMEM cell
containing invalid MAC.

3. Simplify code
Don't move cell reading & nvmem_cell_put() into a loop. Simplify loop
code.

Fixes: ecd81de7a5ab ("ath79: add nvmem cell mac-address-ascii support")
Cc: Yousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch
target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch