2019-05-29 07:30:14

by Ding Xiang

[permalink] [raw]
Subject: [PATCH] mtd: afs: remove unneeded NULL check

NULL check before kfree is unneeded, so remove it.

Signed-off-by: Ding Xiang <[email protected]>
---
drivers/mtd/parsers/afs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/parsers/afs.c b/drivers/mtd/parsers/afs.c
index 0c73002..972b260 100644
--- a/drivers/mtd/parsers/afs.c
+++ b/drivers/mtd/parsers/afs.c
@@ -383,8 +383,7 @@ static int parse_afs_partitions(struct mtd_info *mtd,

out_free_parts:
while (i >= 0) {
- if (parts[i].name)
- kfree(parts[i].name);
+ kfree(parts[i].name);
i--;
}
kfree(parts);
--
1.9.1




2019-07-07 19:38:47

by Richard Weinberger

[permalink] [raw]
Subject: Re: [PATCH] mtd: afs: remove unneeded NULL check

On Wed, May 29, 2019 at 9:19 AM Ding Xiang
<[email protected]> wrote:
>
> NULL check before kfree is unneeded, so remove it.
>
> Signed-off-by: Ding Xiang <[email protected]>

Applied.

--
Thanks,
//richard