Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3475083pxb; Mon, 16 Nov 2020 16:07:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAS15O6EWUXgif1lhYDd/3UG4rk684V/yZIGHgDjwF3WLTklJ4BVPMExbeyAISvvoHafbg X-Received: by 2002:a50:cf46:: with SMTP id d6mr18695475edk.356.1605571624327; Mon, 16 Nov 2020 16:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605571624; cv=none; d=google.com; s=arc-20160816; b=UoivcQMIjLOoS2C9dm4bnnXLEUfzY3iGsAsExs3mu6F5aoKNcVs9T+wEw6hPyCGKl3 5c+dIapn4384yYKcgjHR2aho+ghze1jidL0LrO2iJNbO4xLn5F1QHrtP44GEv3djGTXT bBOYZs3VfSv6/c+KhnkMvM5PTn7xa+JRgJro4dXTYEkMWzqhEa2KaoZD75oaOn/TofD7 c6n+VJeLe2rs5jZKNTCD3oK+cywvMfZflLZFm14HLtlTB7UxGG+hOsHYh1yvraWvfpUn u9xlNezt9qJ4aiEPgb3vvFjIzMEospNiaxojEZcHhWb66N5mu9lSXONJ1IS6DKuiTpg2 /y6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=rMqrd9bN3U/F6oR7C3Q9Rgk6zXcCW8Cf85L9usMdYJU=; b=mHsiYnqprz2YunqeMCyTcXvvoavnGl9PRmK+or1E//cmGpmZ3dW1g/51sxIIM4KRbg EqbK9WwBm2tKl3DB98sokat24oQR4XioZiKjICGBk2mGV3Ki82aG119HPnFKgw49YlXd QU1VVx9mrUx/k9XGr0CkJtXjJNzoFKP4rk1jRmEqhx9RmP67BTZqtHH4df/022ePejNT hKAY48WLGukxf5e1TLx3UTApHF5IMim2p5kbx9B+e4pDuZDgHyyPmwPqfkhioluvRxvw UKeGyF7ODjESQh1OJcCg8UH+KdC5I9ntTs/zrN8Ij5AHpVZ3pB8BeOwpu7KRzbFqvade V9mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DK58guNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si12472591ejc.458.2020.11.16.16.06.41; Mon, 16 Nov 2020 16:07:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DK58guNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731326AbgKQACW (ORCPT + 99 others); Mon, 16 Nov 2020 19:02:22 -0500 Received: from z5.mailgun.us ([104.130.96.5]:35754 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730772AbgKQACV (ORCPT ); Mon, 16 Nov 2020 19:02:21 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605571341; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=rMqrd9bN3U/F6oR7C3Q9Rgk6zXcCW8Cf85L9usMdYJU=; b=DK58guNZasGev/3RahBSzFJv74eJ7ujyDTZIbKTovILQC2rQGFzfdmk1ikeaNvzj4CfneR5+ BdVjuiSktU5YajeErJaUWLcEKwdZyTA4rCzjitQT2CiqeMT/l2BMGDUhG2mb/Z3cOVpy379h 9iezasKaTBD0rEa3KAXgxOrzhKY= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 5fb312ebe9dd187f53905091 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 17 Nov 2020 00:01:47 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C3768C43460; Tue, 17 Nov 2020 00:01:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from malabar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bbhatt) by smtp.codeaurora.org (Postfix) with ESMTPSA id B459DC433C6; Tue, 17 Nov 2020 00:01:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B459DC433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=bbhatt@codeaurora.org From: Bhaumik Bhatt To: manivannan.sadhasivam@linaro.org, kvalo@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Bhaumik Bhatt Subject: [PATCH] ath11k: use MHI provided APIs to allocate and free MHI controller Date: Mon, 16 Nov 2020 16:01:40 -0800 Message-Id: <1605571300-4438-1-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use MHI provided APIs to allocate and free MHI controller to improve MHI host driver handling. This also fixes a memory leak as the MHI controller was allocated but never freed. Signed-off-by: Bhaumik Bhatt --- drivers/net/wireless/ath/ath11k/mhi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c index aded9a7..1c9d9dc 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -218,7 +218,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) struct mhi_controller *mhi_ctrl; int ret; - mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL); + mhi_ctrl = mhi_alloc_controller(); if (!mhi_ctrl) return -ENOMEM; @@ -234,7 +234,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ret = ath11k_mhi_get_msi(ab_pci); if (ret) { ath11k_err(ab, "failed to get msi for mhi\n"); - kfree(mhi_ctrl); + mhi_free_controller(mhi_ctrl); return ret; } @@ -252,7 +252,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config); if (ret) { ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret); - kfree(mhi_ctrl); + mhi_free_controller(mhi_ctrl); return ret; } @@ -265,6 +265,7 @@ void ath11k_mhi_unregister(struct ath11k_pci *ab_pci) mhi_unregister_controller(mhi_ctrl); kfree(mhi_ctrl->irq); + mhi_free_controller(mhi_ctrl); } static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project