diff options
author | Ziyang Xuan <william.xuanziyang@huawei.com> | 2022-06-06 21:14:01 +0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2022-07-13 08:38:20 -0700 |
commit | 9b00a5f50934b74c61982dcd30b2c21e07d0d317 (patch) | |
tree | ecf61c2b768e17e54eedb0187a19c8166bff0b29 /drivers/hwmon/occ | |
parent | f9938eeb97fc786148809be6ca752c0c6baebf49 (diff) | |
download | lwn-9b00a5f50934b74c61982dcd30b2c21e07d0d317.tar.gz lwn-9b00a5f50934b74c61982dcd30b2c21e07d0d317.zip |
hwmon: (occ) Delete unnecessary NULL check
kvfree(NULL) is safe. NULL check before kvfree() is not needed.
Delete them to simplify the code.
Generated by coccinelle script:
scripts/coccinelle/free/ifnullfree.cocci
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20220606131401.4053036-1-william.xuanziyang@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/occ')
-rw-r--r-- | drivers/hwmon/occ/p9_sbe.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c index a91937e28e12..c1e0a1d96cd4 100644 --- a/drivers/hwmon/occ/p9_sbe.c +++ b/drivers/hwmon/occ/p9_sbe.c @@ -55,8 +55,7 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp, mutex_lock(&ctx->sbe_error_lock); if (!ctx->sbe_error) { if (resp_len > ctx->ffdc_size) { - if (ctx->ffdc) - kvfree(ctx->ffdc); + kvfree(ctx->ffdc); ctx->ffdc = kvmalloc(resp_len, GFP_KERNEL); if (!ctx->ffdc) { ctx->ffdc_len = 0; @@ -170,8 +169,7 @@ static int p9_sbe_occ_remove(struct platform_device *pdev) ctx->sbe = NULL; occ_shutdown(occ); - if (ctx->ffdc) - kvfree(ctx->ffdc); + kvfree(ctx->ffdc); return 0; } |