Re: [PATCH 3/3] EDAC, mce_amd: Correct error paths

From: Aravind Gopalakrishnan
Date: Wed Mar 02 2016 - 10:56:44 EST


On 3/2/2016 4:54 AM, Borislav Petkov wrote:
From: Borislav Petkov <bp@xxxxxxx>
Date: Wed, 2 Mar 2016 11:46:58 +0100
Subject: [PATCH 3/3] EDAC, mce_amd: Correct error paths

We need to unwind properly when we fail to find the proper decoding
functions. Streamline error messages to resemble the rest of this file,
while at it and do some minor stylistic changes.

Signed-off-by: Borislav Petkov <bp@xxxxxxx>

Looks good. Thanks.

Reviewed-by: Aravind Gopalakrishnan<aravind.gopalakrishnan@xxxxxxx>

-
default:
printk(KERN_WARNING "Huh? What family is it: 0x%x?!\n", c->x86);
- kfree(fam_ops);
- fam_ops = NULL;
+ goto err_out;
}
pr_info("MCE: In-kernel MCE decoding enabled.\n");
@@ -1225,6 +1224,11 @@ static int __init mce_amd_init(void)
mce_register_decode_chain(&amd_mce_dec_nb);
return 0;
+
+err_out:
+ kfree(fam_ops);
+ fam_ops = NULL;
+ return -EINVAL;

Thanks! Sorry I missed this.

-Aravind.