mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 08:40:54 +07:00
mtd: mtdconcat: fix bug with uninitialized lock and unlock functions
Test if a lock or unlock function is present (pointer not NULL) before calling it, to prevent a kernel dump. Artem: removed extra blank lines Signed-off-by: Martin Krause <martin.krause@tqs.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
24cc7b8a2a
commit
e1d0fe3cdd
@ -540,10 +540,12 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
else
|
||||
size = len;
|
||||
|
||||
err = subdev->lock(subdev, ofs, size);
|
||||
|
||||
if (err)
|
||||
break;
|
||||
if (subdev->lock) {
|
||||
err = subdev->lock(subdev, ofs, size);
|
||||
if (err)
|
||||
break;
|
||||
} else
|
||||
err = -EOPNOTSUPP;
|
||||
|
||||
len -= size;
|
||||
if (len == 0)
|
||||
@ -578,10 +580,12 @@ static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
else
|
||||
size = len;
|
||||
|
||||
err = subdev->unlock(subdev, ofs, size);
|
||||
|
||||
if (err)
|
||||
break;
|
||||
if (subdev->unlock) {
|
||||
err = subdev->unlock(subdev, ofs, size);
|
||||
if (err)
|
||||
break;
|
||||
} else
|
||||
err = -EOPNOTSUPP;
|
||||
|
||||
len -= size;
|
||||
if (len == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user