From patchwork Mon Dec 28 12:48:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 352739 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9857867jai; Mon, 28 Dec 2020 08:09:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwF228t9NK9GyCRnKGz9Q5tvkFfvh8jSAtaCreE10HSF1p01ENV/GFv0biVqRhaEPNqvPZG X-Received: by 2002:a05:6402:1041:: with SMTP id e1mr44410964edu.54.1609171770096; Mon, 28 Dec 2020 08:09:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609171770; cv=none; d=google.com; s=arc-20160816; b=a/eFrjVw8AJpFjaO0LCY5Hb0SsnDfllAGTVdf16+KjjFMP91jsjuYhxSVAUrpBXj4q 9kc8oAmq6G9b48Suk1iu466u9SgwUZk9AkRCnUfwBGsWaQ2hraYjp5c1xWTbqW202B5c oq48KzzP5zoME1pURzT1t7wNAhb38hHviy9dbos1YcdW04g3rlqT8sTbNHzjJ/2YeyjC nda9oYihpUdYG9+OMCaVmWYJiVsSdkEPWCoE0FNXdugQTUbiD5EZV1KRyDoIsDHtriu7 +MAjq2FBLD+8wlezSmrkerZ4Yt+sak1eNMA2/mpnKLrfEvJDJG4rJi9FnYAP17aG1TQO eHaw== 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=NdhnbjbSvzTcJAKZz88fOpjHilDoygbmSVKJqJiMnJY=; b=Nt/FiQUUwvifE/byJMCLC2fQB607YLKbUs9L91UBWblODOXjYe/55F1WNUUsmcMtM2 we2LQFs9P1F3Dk4xVH/IR4+AANpzw//0S7GaFCDM86mKa3w5MaTh4mVqNCFL41GmXFBp aPxCXofsou276eFcc0eE5kj+2R/Kx/dfxWh6wVCtmHWWUQ5GfV11T4DVpPJRh749SoTu At+E3Bt0kTZQhumrRgam8x7iW9vu9BAjBgx64OOx1h3D8eBe4Vg4MogOE31NxuVhJiWf Gl+omQdsN4vDTp2pPJZp03ftke7BVVGfa5zTkfP9UmuFZ7ODnf+GdwVHZ9Q338CLnIBf 3yUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DGWlM3vG; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 cb24si19732983edb.552.2020.12.28.08.09.29; Mon, 28 Dec 2020 08:09:30 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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=DGWlM3vG; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S2388005AbgL1QEo (ORCPT + 14 others); Mon, 28 Dec 2020 11:04:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:56334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389760AbgL1N1y (ORCPT ); Mon, 28 Dec 2020 08:27:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD77322B40; Mon, 28 Dec 2020 13:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162058; bh=/Jik/UAVugPTOcm7K+/Agzh+F93IeBdxAX1SpkyMsfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGWlM3vG99aLctKRJHPoby3ikMJK7dqdeBrGttfXBzKk7uQLvwUqHGk3p+qV9e223 vkxo/lg48R0X7FlDRsUdVz3tu27C86XFbNje29W5qBZETw+5e0lgo5N2cal95aLfd9 8t4dB2oK8xfR+v535AxNAXX1Gh7cKUT//nhMzvjU= 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 4.19 173/346] slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI Date: Mon, 28 Dec 2020 13:48:12 +0100 Message-Id: <20201228124928.146879893@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124919.745526410@linuxfoundation.org> References: <20201228124919.745526410@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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(+) -- 2.27.0 diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 522a87fc573a6..44021620d1013 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1200,6 +1200,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) { @@ -1493,6 +1496,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);