Skip to content

Commit

Permalink
base-files: clean up ubinized sysupgrade code
Browse files Browse the repository at this point in the history
Remove redundant check from nand ubinized sysupgrade code. This check
has already been done in the only caller of the affected function:
nand_do_upgrade.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
  • Loading branch information
Lanchon authored and dangowrt committed Apr 19, 2022
1 parent 264d948 commit de4b65a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions package/base-files/files/lib/upgrade/nand.sh
Expand Up @@ -236,22 +236,18 @@ nand_upgrade_ubinized() {
local ubi_file="$1"
local mtdnum="$(find_mtd_index "$CI_UBIPART")"

[ ! "$mtdnum" ] && {
CI_UBIPART="rootfs"
mtdnum="$(find_mtd_index "$CI_UBIPART")"
}

if [ ! "$mtdnum" ]; then
echo "cannot find mtd device $CI_UBIPART"
umount -a
reboot -f
fi

local mtddev="/dev/mtd${mtdnum}"
ubidetach -p "${mtddev}" || true
ubidetach -p "${mtddev}" || :
sync
ubiformat "${mtddev}" -y -f "${ubi_file}"
ubiattach -p "${mtddev}"

nand_do_upgrade_success
}

Expand Down Expand Up @@ -333,7 +329,7 @@ nand_upgrade_tar() {
nand_do_upgrade() {
local file_type=$(identify $1)

[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs"
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART=rootfs

case "$file_type" in
"fit") nand_upgrade_fit $1;;
Expand Down

0 comments on commit de4b65a

Please sign in to comment.