Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e516aba authored by Hamad Kadmany's avatar Hamad Kadmany
Browse files

msm_11ad: Add proper NULL check



Failure of memory allocation for context was
not properly checked. Added proper check against
valid context value in relevant locations.

Change-Id: Ia74ddfb3c54e2781957e695a831c30f1356fed08
Signed-off-by: default avatarHamad Kadmany <hkadmany@codeaurora.org>
parent ad7fa3de
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ static int msm_11ad_probe(struct platform_device *pdev)
	int rc;

	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
	if (!dev)
	if (!ctx)
		return -ENOMEM;

	ctx->dev = dev;
@@ -402,6 +402,11 @@ int msm_11ad_modinit(void)
							   struct msm11ad_ctx,
							   list);

	if (!ctx) {
		pr_err("Context not found\n");
		return -EINVAL;
	}

	if (ctx->pristine_state) {
		/* in old kernels, pci_load_saved_state() is not exported;
		 * so use pci_load_and_free_saved_state()