Skip to content

Commit

Permalink
UBIFS: call dbg_is_power_cut() instead of reading c->dbg->pc_happened
Browse files Browse the repository at this point in the history
Call dbg_is_power_cut() to emulate power cut instead of reading
c->dbg->pc_happened. Otherwise, the function becomes dead code.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
shengyong authored and Richard Weinberger committed Oct 3, 2015
1 parent f9a113d commit 8f6983a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/ubifs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,7 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf,
{
int err, failing;

if (c->dbg->pc_happened)
if (dbg_is_power_cut(c))
return -EROFS;

failing = power_cut_emulated(c, lnum, 1);
Expand All @@ -2595,7 +2595,7 @@ int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf,
{
int err;

if (c->dbg->pc_happened)
if (dbg_is_power_cut(c))
return -EROFS;
if (power_cut_emulated(c, lnum, 1))
return -EROFS;
Expand All @@ -2611,7 +2611,7 @@ int dbg_leb_unmap(struct ubifs_info *c, int lnum)
{
int err;

if (c->dbg->pc_happened)
if (dbg_is_power_cut(c))
return -EROFS;
if (power_cut_emulated(c, lnum, 0))
return -EROFS;
Expand All @@ -2627,7 +2627,7 @@ int dbg_leb_map(struct ubifs_info *c, int lnum)
{
int err;

if (c->dbg->pc_happened)
if (dbg_is_power_cut(c))
return -EROFS;
if (power_cut_emulated(c, lnum, 0))
return -EROFS;
Expand Down

0 comments on commit 8f6983a

Please sign in to comment.