KillZramBackingDevice: Return immediately if backing_dev is none.

It's possible that CONFIG_ZRAM_WRITEBACK is y,
but userspace doesn't set the /sys/block/zram0/backing_dev,
so its value is 'none'.
It's the same with "CONFIG_ZRAM_WRITEBACK is not set".

Change-Id: I2df89ceee68e4685deef5113bada21be96779e9b
Signed-off-by: shisiyuan <shisiyuan@xiaomi.com>
This commit is contained in:
shisiyuan 2021-05-18 11:47:43 +08:00
parent a6c57d5752
commit 423c4f1994

View file

@ -478,6 +478,11 @@ static Result<void> KillZramBackingDevice() {
// cut the last "\n"
backing_dev.erase(backing_dev.length() - 1);
if (android::base::StartsWith(backing_dev, "none")) {
LOG(INFO) << "No zram backing device configured";
return {};
}
// shutdown zram handle
Timer swap_timer;
LOG(INFO) << "swapoff() start...";