Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9082222pxu; Mon, 28 Dec 2020 06:12:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVY+VQ68Ibrk3n5IHbgOD7AfWWm5srt+ar8dVkfv+KKNp69BB6SX5/uft0CpMQyD5JQvCm X-Received: by 2002:a17:907:271c:: with SMTP id w28mr41838161ejk.140.1609164750993; Mon, 28 Dec 2020 06:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164750; cv=none; d=google.com; s=arc-20160816; b=H/9PqJTYIBz9DkbUf+jigyWgruKsE2QUr0xkb2t3yUWT0OvHYTBC1988ePvC7T4juf pGMis//KJoGZKotk0UQ01RH5PLG/SuzfKyhaY5ezZdM7L2xV6SpiFRRUY0h8bHMEISzo JrFtra3uh/SQA4dVJd2Cnj0fnaGa9D6qWjxsIr/fKcygn5oe8uj5a/uI9INWhZ3MCPMK THyWnZy/NJMJm3ljSkMs3agCFL4iEHoYeQtSMoy7ln3MwGxkF3suR+fcMxBMTsatUdzM falwojRbGsq5HRLz0EJtp4K8IsNJSeW9Oxmkqm9/qauH2F/4oMCDAYipEkcL1dMgxyb3 s8Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ufPBxlnsBb7MIutHEUQwpQ3RVLWPbvUM4aQv/4fC0bw=; b=FgnNYWRZWRpGG8+rXRgqWOnRVKUvqCuQ3kYdUhc2VtQMph8Eapqn8LrK/01QmXwVGF edmJPdfq5C6XFo0A6G3cy77HRkyWtW/KzuUiakWycf0hA8IGtsAUFpnUR7u68on1vl87 WGNOc69lheOc41wCm1k7WNOGFBWnDiLdOYAUiXHs+J3SRP9VI7o4oLdHeG0Bg2qOS2nX GenQGt7ODr0GHua4T4mFPnWbQ/KqNkAOImIVsBRvIJjBP71UuHkvEoAEzxxAR4FxHcm3 bCBzrW32b7OTJI1f4+vORGbGzaiJVhcN9zJBvhdf+S4Mf41WFQYtW4HbhtdLQpeMLkU0 LefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wuxxi6wB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 7si19346493edw.324.2020.12.28.06.12.06; Mon, 28 Dec 2020 06:12:30 -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=@linuxfoundation.org header.s=korg header.b=Wuxxi6wB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438975AbgL1OKN (ORCPT + 99 others); Mon, 28 Dec 2020 09:10:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:44616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438963AbgL1OKL (ORCPT ); Mon, 28 Dec 2020 09:10:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F7DE206C3; Mon, 28 Dec 2020 14:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164570; bh=WZZNQL4waOwc5Rt/nP4qhfP11LZ1Qtc92pWShd0huvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wuxxi6wBJDItqkSEMWwmssJXdapPK1/VwoXGuxDinhtQ3O5qM98Yugd97a4q1lKPb zqsEsaeDOkm7JsSZwG/KKZyuRiGTdZ3UAboTUaTR/ZpkoG4d/ZIVA1sz8Jv73mDMWO tiq3gJdFtVVOYcKeOnYMzrLuBGmvghm/WdLX5eZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 5.10 222/717] slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI Date: Mon, 28 Dec 2020 13:43:40 +0100 Message-Id: <20201228125031.618183747@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson [ Upstream commit 39014ce6d6028614a46395923a2c92d058b6fa87 ] Attempting to send a power request during PM operations, when the QMI handle isn't initialized results in a NULL pointer dereference. So check if the QMI handle has been initialized before attempting to post the power requests. Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver") Signed-off-by: Bjorn Andersson Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20201127102451.17114-7-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/slimbus/qcom-ngd-ctrl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 218aefc3531cd..50cfd67c2871e 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1205,6 +1205,9 @@ static int qcom_slim_ngd_runtime_resume(struct device *dev) struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); int ret = 0; + if (!ctrl->qmi.handle) + return 0; + if (ctrl->state >= QCOM_SLIM_NGD_CTRL_ASLEEP) ret = qcom_slim_ngd_power_up(ctrl); if (ret) { @@ -1503,6 +1506,9 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev) struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); int ret = 0; + if (!ctrl->qmi.handle) + return 0; + ret = qcom_slim_qmi_power_request(ctrl, false); if (ret && ret != -EBUSY) dev_info(ctrl->dev, "slim resource not idle:%d\n", ret); -- 2.27.0