From patchwork Fri Feb 28 18:33:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11413163 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA61C924 for ; Fri, 28 Feb 2020 18:34:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9DB7246AF for ; Fri, 28 Feb 2020 18:34:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rZHhsOAu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbgB1SeG (ORCPT ); Fri, 28 Feb 2020 13:34:06 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:33364 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbgB1SeF (ORCPT ); Fri, 28 Feb 2020 13:34:05 -0500 Received: by mail-yw1-f65.google.com with SMTP id j186so4281251ywe.0 for ; Fri, 28 Feb 2020 10:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GIcV50HzfFuzHnFyxJZaw5ayTXhu+ot1cYJZR5HNC2I=; b=rZHhsOAub+cbp14f0VQ94mMSWV+s83mEdNkA061F4J1uF3G54XpGHLT0hB3XBf0b9l vQBZrBGUl464onvfp7WNa0eFDneYBz/SZmtOk4UFQQqTISZRyLjF0Ijxw4lJS11xjvd8 W9ED6lThimFZMP+nCTqUxWka0vWjrqd6PX630j8loEy1Pi/JnrrLck/3sFUxtOSl9ZhQ 7b/KFiYweB5+DySbOgti5DiHQbbWM0fdByQaoKFbMFjkVoW5DFyoJYI9UyESyx95zEFU HgrwrZuwIq3v1cjE4xtG2woxXufkxtKoCd0QL9jUsvVcMjkv+yXlZgMw323aCfm6f0Dt xR9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GIcV50HzfFuzHnFyxJZaw5ayTXhu+ot1cYJZR5HNC2I=; b=lNV8Tf3zEChw57kV7YpzZfDC0xPWowsP5nHbnWpLopj/RJWkEYMUT4AxgJo1rkUT9Y JTG99Cwqmq/qzLVXj5NNKphDL2jlUQJtpmFl7b3dO4BA3IJ00XfGabHBDt1WOxYYDfM9 POWqfLH7M9K6vV4ndgPNjWDwNJGW75cWuH1PohlrPg6Ms+URSNvBNOcHtykBDHiCrK+H 6DjPp32dgt4nW+5f0R6xtoEc7sIM8sUfc+z6IOmstxjrkngzXDdy7yKf1OiP4qJZ8YEV lk0STC84l1xDZgybnMdMk6oT3kZ+jS1X6jPtBeVXTILoQbpSBoHYWolmbkPZgZ42ErPP SO7Q== X-Gm-Message-State: APjAAAVoHoXElsYKKFjywerKD+Zb8WgCGl1pgFg1KszVgC4TEbnq5pk7 mS4GaCGCKezhgtKnvrdqKfdJpQ== X-Google-Smtp-Source: APXvYqy0T88Ery5T/84/Na8fYDmQec02Ukk7u5LokLZ6FVxaUPs9/9ebRaw/9+yxnnxgyVs/hIEmqA== X-Received: by 2002:a25:aa6a:: with SMTP id s97mr4799522ybi.232.1582914844407; Fri, 28 Feb 2020 10:34:04 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id o127sm4409884ywf.43.2020.02.28.10.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 10:34:03 -0800 (PST) From: Alex Elder To: Ohad Ben-Cohen , Bjorn Andersson , Andy Gross Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] remoteproc: re-check state in rproc_trigger_recovery() Date: Fri, 28 Feb 2020 12:33:56 -0600 Message-Id: <20200228183359.16229-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228183359.16229-1-elder@linaro.org> References: <20200228183359.16229-1-elder@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Two places call rproc_trigger_recovery(): - rproc_crash_handler_work() sets rproc->state to CRASHED under protection of the mutex, then calls it if recovery is not disabled. This function is called in workqueue context when scheduled in rproc_report_crash(). - rproc_recovery_write() calls it in two spots, both of which the only call it if the rproc->state is CRASHED. The mutex is taken right away in rproc_trigger_recovery(). However, by the time the mutex is acquired, something else might have changed rproc->state to something other than CRASHED. The work that follows that is only appropriate for a remoteproc in CRASHED state. So check the state after acquiring the mutex, and only proceed with the recovery work if the remoteproc is still in CRASHED state. Delay reporting that recovering has begun until after we hold the mutex and we know the remote processor is in CRASHED state. Signed-off-by: Alex Elder --- drivers/remoteproc/remoteproc_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 097f33e4f1f3..d327cb31d5c8 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1653,12 +1653,16 @@ int rproc_trigger_recovery(struct rproc *rproc) struct device *dev = &rproc->dev; int ret; + ret = mutex_lock_interruptible(&rproc->lock); + if (ret) + return ret; + + /* State could have changed before we got the mutex */ + if (rproc->state != RPROC_CRASHED) + goto unlock_mutex; + dev_err(dev, "recovering %s\n", rproc->name); - ret = mutex_lock_interruptible(&rproc->lock); - if (ret) - return ret; - ret = rproc_stop(rproc, true); if (ret) goto unlock_mutex; From patchwork Fri Feb 28 18:33:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11413177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 091B6924 for ; Fri, 28 Feb 2020 18:34:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DCA24246AC for ; Fri, 28 Feb 2020 18:34:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UiBE4LUU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbgB1SeR (ORCPT ); Fri, 28 Feb 2020 13:34:17 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:35193 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbgB1SeG (ORCPT ); Fri, 28 Feb 2020 13:34:06 -0500 Received: by mail-yw1-f67.google.com with SMTP id i190so4265610ywc.2 for ; Fri, 28 Feb 2020 10:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EH+UfAG3Moaz/zeIaZSYJJWmoPikxMZ1T1SkhnjF0wU=; b=UiBE4LUUyWqKf3RBr/SRdVBrgfZDD9K/4Pf1Yrwxg9Q/2icOm+kek4+X23P2F0Vk3p 8I+ub/S6DKjZasKOjoFmG6Iac/pvt5dtjIPL7eXrQttzLM/toOC/39xGM3zmC5VYVoCg 8KnVuJuenFzirRMWG6fSagXGMRcOZTHEp53x4pHwM8oO/xr1SaWjy2p7ZNd0AmIfBpCR A6O1/pLE2Enu1VHhJ9W9knf8ka8o6bCQsmbwTNwHfGcvJEo9PfrGyuTw7WqLzY00gV2v wKZRniTNdnUJDUVzSK7H4JdxMHp4FUaVTvV2hZFjSdSOD7/REivyauQBy2ymKR2Tn+Ju pWuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EH+UfAG3Moaz/zeIaZSYJJWmoPikxMZ1T1SkhnjF0wU=; b=T3cphC/xZVnZn+9fUCL8sVj5x4XhJ6+FGMNd7yITX6YjIaCBgDPE8yBkx9a0gNB5Bt mLs1PSqP3VOYNi3IkqGwj6ih+IAMXqFLCfulb1kn/jea33WUjdfUxCZ/1BQCQD8lvzg3 LZ1tuzOpaGdAexKmUjO0TUpDrvuEr/4cikaLFVjGiimqYzut13r+CoiBF12+q3Iap1EC T4TXhl3UZvZ0gq0CRusAj3UuONh3EX7E1LUABPnt+0BJ9aNzZ3vI80eY3D18qbXWD2uf faTi7S7BH9qwDP7WQwrrgdUdjQ1I2CiHgYDads5IGhbWQm98QoXOE3Zozg/8Lk8S+v3h uoTg== X-Gm-Message-State: APjAAAXRGR4wiw/COfSdzcmxvRbz6kvc+mfdWmVze6wvUmTwkrq/VWEX kofL6NUGpADMChRnVnnhyKR1NA== X-Google-Smtp-Source: APXvYqz+sl6V3tkKPiNzqxIm0lykhAAZHbbZJj9QhcnMa0+XvYu4P4D/XJJiv2YnN2vJ01AOUeO9ww== X-Received: by 2002:a25:6d54:: with SMTP id i81mr4658616ybc.323.1582914845509; Fri, 28 Feb 2020 10:34:05 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id o127sm4409884ywf.43.2020.02.28.10.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 10:34:05 -0800 (PST) From: Alex Elder To: Ohad Ben-Cohen , Bjorn Andersson , Andy Gross Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] remoteproc: remoteproc debugfs file fixes Date: Fri, 28 Feb 2020 12:33:57 -0600 Message-Id: <20200228183359.16229-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228183359.16229-1-elder@linaro.org> References: <20200228183359.16229-1-elder@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Don't bother checking the remoteproc state before calling rproc_trigger_recovery() because that function will verify the state, and the state can only be safely checked while holding the mutex anyway. Make the mode for "recovery" be writable. Signed-off-by: Alex Elder --- drivers/remoteproc/remoteproc_debugfs.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index dd93cf04e17f..e995dc49c231 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -138,16 +138,14 @@ rproc_recovery_write(struct file *filp, const char __user *user_buf, buf[count - 1] = '\0'; if (!strncmp(buf, "enabled", count)) { + /* change the flag and begin the recovery process if needed */ rproc->recovery_disabled = false; - /* if rproc has crashed, trigger recovery */ - if (rproc->state == RPROC_CRASHED) - rproc_trigger_recovery(rproc); + rproc_trigger_recovery(rproc); } else if (!strncmp(buf, "disabled", count)) { rproc->recovery_disabled = true; } else if (!strncmp(buf, "recover", count)) { - /* if rproc has crashed, trigger recovery */ - if (rproc->state == RPROC_CRASHED) - rproc_trigger_recovery(rproc); + /* begin the recovery process without changing the flag */ + rproc_trigger_recovery(rproc); } return count; @@ -349,7 +347,7 @@ void rproc_create_debug_dir(struct rproc *rproc) debugfs_create_file("name", 0400, rproc->dbg_dir, rproc, &rproc_name_ops); - debugfs_create_file("recovery", 0400, rproc->dbg_dir, + debugfs_create_file("recovery", 0600, rproc->dbg_dir, rproc, &rproc_recovery_ops); debugfs_create_file("crash", 0200, rproc->dbg_dir, rproc, &rproc_crash_ops); From patchwork Fri Feb 28 18:33:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11413167 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E73DC14B4 for ; Fri, 28 Feb 2020 18:34:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7A85246AF for ; Fri, 28 Feb 2020 18:34:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RM8lTbkh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726906AbgB1SeH (ORCPT ); Fri, 28 Feb 2020 13:34:07 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:42402 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbgB1SeH (ORCPT ); Fri, 28 Feb 2020 13:34:07 -0500 Received: by mail-yw1-f68.google.com with SMTP id n127so4212296ywd.9 for ; Fri, 28 Feb 2020 10:34:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VeDGK1DiIdZtOrN6jbdO+ELiBjixQ8axv7+HJNQG5oA=; b=RM8lTbkh0pyorHIuPOfxmMVRhdFj7HaQ15++AS2/440X2YXK012m8+JOjFjB2maihP fLfm+YyuxpbUl+Kl4ia/DxxO3LS9t1JwDoR3lS8e/BCuN6D8Y1R7G0QNlvpMajuLe1IB Xcddy97cj71R2+UEYuxIH0b8ddRhBgRteNpX/DQIbxl5xXoEFWtRRdfWmTnn60avD8Z7 Ir08Q+ZS9whrKd29OxhkJXCxB+TFKbtMm+cc6IUc8HBWfOFrGa7caLpvWpp9oln2Ys96 6jg13fAlLczHhZP7E6DzMvbZJ6OfamslRDJrcNqpuaIvgkdpwgHbtGiP5R6KjVfTYCUR KsdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VeDGK1DiIdZtOrN6jbdO+ELiBjixQ8axv7+HJNQG5oA=; b=rPMUNFxWVyi88/O5LftZOJS3tCH0Uxmf9rSlL97DKkNIiYEBFamwqq4piH6p3o299Y GlsS/4k1kmZnDmTPasxaqhzWLOwnLQ0iCYdQeVT6aLuteJ7j9EQaWjft+WusKo2qeaE8 2fE/aNVZ6O26faTCHHV3Ek8DIjChBW6w8zBZxoW5rOzICDA5dgOa9yynvngQU7SB0QyJ h7qnW8z4zS9T46TeDt1PpDxHrlRBW4HjcnPzf/LIzXPj722jwu5B79v1osYTGgmFYUug +f/UM0Dr4hKLw5Lc1hxgk93ahiMb3FUf9gsFYIn8xC09+7rl/9PiKoI2K33I6QOoEdiO v3wQ== X-Gm-Message-State: APjAAAUoucewUI5zyAl9+qo/bTGywjRxaZC1rb7t9VeWyXPbsFlWMAva zGo/kuPFJ0zlsJbeYGvnnpZFu1UrD0E= X-Google-Smtp-Source: APXvYqziFPUBR8YJ5qjsnsAx4FXUg+cg5+ZJp/RfibCbaSSFf516TjuQSNhgFXljctpfBkfnewR3vA== X-Received: by 2002:a25:dcb:: with SMTP id 194mr2990013ybn.304.1582914846582; Fri, 28 Feb 2020 10:34:06 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id o127sm4409884ywf.43.2020.02.28.10.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 10:34:06 -0800 (PST) From: Alex Elder To: Ohad Ben-Cohen , Bjorn Andersson , Andy Gross Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] remoteproc: qcom: fix q6v5 probe error paths Date: Fri, 28 Feb 2020 12:33:58 -0600 Message-Id: <20200228183359.16229-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228183359.16229-1-elder@linaro.org> References: <20200228183359.16229-1-elder@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Remove the remoteproc subdevices if an error occurs after they have been added. Have cleanup activity done in q6v5_remove() be done in the reverse order they are set up in q6v5_probe() (and the same order they're done in the q6v5_probe() error path). Use a local variable for the remoteproc pointer, which is used repeatedly. Signed-off-by: Alex Elder --- drivers/remoteproc/qcom_q6v5_mss.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index a1cc9cbe038f..97093f4f58e1 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -1667,15 +1667,21 @@ static int q6v5_probe(struct platform_device *pdev) qproc->sysmon = qcom_add_sysmon_subdev(rproc, "modem", 0x12); if (IS_ERR(qproc->sysmon)) { ret = PTR_ERR(qproc->sysmon); - goto detach_proxy_pds; + goto remove_ssr_subdev; } ret = rproc_add(rproc); if (ret) - goto detach_proxy_pds; + goto remove_sysmon_subdev; return 0; +remove_sysmon_subdev: + qcom_remove_sysmon_subdev(qproc->sysmon); +remove_ssr_subdev: + qcom_remove_ssr_subdev(qproc->rproc, &qproc->ssr_subdev); + qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev); + qcom_remove_glink_subdev(qproc->rproc, &qproc->glink_subdev); detach_proxy_pds: q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); detach_active_pds: @@ -1689,18 +1695,19 @@ static int q6v5_probe(struct platform_device *pdev) static int q6v5_remove(struct platform_device *pdev) { struct q6v5 *qproc = platform_get_drvdata(pdev); + struct rproc *rproc = qproc->rproc; - rproc_del(qproc->rproc); + rproc_del(rproc); qcom_remove_sysmon_subdev(qproc->sysmon); - qcom_remove_glink_subdev(qproc->rproc, &qproc->glink_subdev); - qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev); - qcom_remove_ssr_subdev(qproc->rproc, &qproc->ssr_subdev); + qcom_remove_ssr_subdev(rproc, &qproc->ssr_subdev); + qcom_remove_smd_subdev(rproc, &qproc->smd_subdev); + qcom_remove_glink_subdev(rproc, &qproc->glink_subdev); - q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); + q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); - rproc_free(qproc->rproc); + rproc_free(rproc); return 0; } From patchwork Fri Feb 28 18:33:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11413173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26A6417E0 for ; Fri, 28 Feb 2020 18:34:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 064BA246AF for ; Fri, 28 Feb 2020 18:34:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="i5m6xuAZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726947AbgB1SeK (ORCPT ); Fri, 28 Feb 2020 13:34:10 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:41812 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726917AbgB1SeK (ORCPT ); Fri, 28 Feb 2020 13:34:10 -0500 Received: by mail-yw1-f65.google.com with SMTP id h6so4223534ywc.8 for ; Fri, 28 Feb 2020 10:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BK15KB/QIM0mjkXnJvo5g++rrPQHZRXMLS7sBMicyC8=; b=i5m6xuAZe5RRVpl8q9MO9a3KL+ZcW7ieF+qHvb+qiofbgjGxKsIAIhKO9J1qRBU/9Z MgdsVOTzz3+Zz7gbctueJQ+AiBNy9C/nwtl38qoAsOGC/kVNWBeA4F7bgiEQB5dQhBh7 dFVSv7wA87+fgSnyffkTnLWbIO6yNNtxooNFuXEZ6GsV0BzxkuCLFQdHQ8RKtEKdjUDm Q2ShYNUkYBX0C03w0l6U+SRJyl/8HKoHY9xrx6osoRQ4IN2qVXqau+027IhIpXREsnhN S/yqZ1k71m5JrbvvAlwowi2PVSfo5moQCk2jy60a90Fr7L3p2XaNIFAKRhq43x3dhGH0 Vh8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BK15KB/QIM0mjkXnJvo5g++rrPQHZRXMLS7sBMicyC8=; b=TBkUaFj3/fGsgknlQEEb1nVvoaqQVK2GWIcl2L6ihxtY/YtduKEbuaLRaIuEAWRJPo nZ43kzEKK0fDeCasnQCVfE1a4tXYVNoiiv7A8RqEVUyb9Te+qSKq9N8eABX0OQAd2QhV GE3gAmsBpgsG37jXVorrtYMG3eezwobtErG5V3Y4IM3Yo4DtqTaOvKBnDcV67fvvXn6u 8Q/+o914as0NKyssqJLrt2whPhMxqVaA46KJTyeov26g16OcWq3gdhTrQljEOiEFqMpr KjMspwlgmc82st5z8rup7zIniOpw9o4WYe+ZaOgngXWSAXKppvr5/p19h59g46F9ml1+ VqLw== X-Gm-Message-State: APjAAAWSbXSuAxB/SokF942u7y7CxTmr0BmRCMIpDHDM64HEqY0Df0PU pVO701dOjmx5W6HJigeQCVn0tw== X-Google-Smtp-Source: APXvYqw8fkpj6XswFJXpxuziB4EMenzmu1+75H7yEeTGC+Rq3p8Us+0TZgQDiD0ZE31ertH7yvc0eg== X-Received: by 2002:a81:2f09:: with SMTP id v9mr5597838ywv.478.1582914847575; Fri, 28 Feb 2020 10:34:07 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id o127sm4409884ywf.43.2020.02.28.10.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 10:34:07 -0800 (PST) From: Alex Elder To: Ohad Ben-Cohen , Bjorn Andersson , Andy Gross Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] remoteproc: return error for bad "recovery" debugfs input Date: Fri, 28 Feb 2020 12:33:59 -0600 Message-Id: <20200228183359.16229-5-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228183359.16229-1-elder@linaro.org> References: <20200228183359.16229-1-elder@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If the value written to the "recovery" debugfs file is not one of the recognized commands return an error to indicate it's invalid. Signed-off-by: Alex Elder --- drivers/remoteproc/remoteproc_debugfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index e995dc49c231..0d478bfefd9c 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -146,6 +146,8 @@ rproc_recovery_write(struct file *filp, const char __user *user_buf, } else if (!strncmp(buf, "recover", count)) { /* begin the recovery process without changing the flag */ rproc_trigger_recovery(rproc); + } else { + return -EINVAL; } return count;