From patchwork Tue Nov 29 16:47:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 84869 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1676887qgi; Tue, 29 Nov 2016 08:47:36 -0800 (PST) X-Received: by 10.84.210.13 with SMTP id z13mr63288648plh.167.1480438056882; Tue, 29 Nov 2016 08:47:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59si32068061plp.46.2016.11.29.08.47.36; Tue, 29 Nov 2016 08:47:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756630AbcK2Qrd (ORCPT + 25 others); Tue, 29 Nov 2016 11:47:33 -0500 Received: from mail-io0-f170.google.com ([209.85.223.170]:36016 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756423AbcK2QrX (ORCPT ); Tue, 29 Nov 2016 11:47:23 -0500 Received: by mail-io0-f170.google.com with SMTP id m5so161463272ioe.3 for ; Tue, 29 Nov 2016 08:47:22 -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; bh=pAt8dWMispOpste6bELYS+OlKNP4dcrXQ8CQciSQIho=; b=bDif/j1SKwb5UHn4oJ5209z4KC0Exq8M8H0OoaVFzTzGPQ2PYxfB9gCrKFFo80Lnpb mh2JP/MPCIzn48xBWn4PhteykDfpPCicYsafTSB11rDR5Fp4R453zgCTtMfgeV50IERi YBGNtRuoS1iZQ7TcOS4SPWJSwvJLx1AV3B+xw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pAt8dWMispOpste6bELYS+OlKNP4dcrXQ8CQciSQIho=; b=bjnoIYiPt6g14RiH1ZI7+pCpSTYrhcbGGsyIT4XPef3IJzbUjQ7WzKVoB9GLTZOjRZ EarEU0ToUb0YZBzcdq3P+8dSypxGiKy5VyoFRcIuQ88ShodlzJIsP6IK9/sZKrbm2g4O LHwujPdB1QukHZ9SP+Y7+UVvNHpzu/YdM4g6PcX7TRlGTQ8mekv0f6sn7LcytbxVK3re VpQnIJnXXiIzOeVp6wtmJumfxTFVUiGybVn61QT1xpVjQ4bNFdgP4qb9tffdjpnIs6K/ Kf1fMnCY/+EsMDuNFdkbvLYO2iwPs+gsg73LbCCIGazx9JiWFxvoyVtz3CN9GojeLjSi ks8Q== X-Gm-Message-State: AKaTC00l/3duiLTD2RP6MpZUCQb85q9sm6L9D2J6+F3SHC08vlCoHIkUCItzK2oWDGnzboP9 X-Received: by 10.36.77.207 with SMTP id l198mr24073083itb.18.1480438042025; Tue, 29 Nov 2016 08:47:22 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id l3sm21810442ioa.7.2016.11.29.08.47.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Nov 2016 08:47:21 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] coresight: stm: return error code instead of zero in .packet() Date: Tue, 29 Nov 2016 09:47:11 -0700 Message-Id: <1480438039-24960-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480438039-24960-1-git-send-email-mathieu.poirier@linaro.org> References: <1480438039-24960-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chunyan Zhang In STM framework driver, the trace data writing loop would keep running until it received a negative return value or the whole trace packet has been written to STM device. So if the .packet() of STM device always returns zero since the device is not enabled or the parameter isn't supported, STM framework driver will stall into a dead loop. Returning -EACCES (Permission denied) in .packet() if the device is disabled makes more sense, and this is the same for returning -EINVAL if the channel passed into is not supported. Signed-off-by: Chunyan Zhang Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-stm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 49e0f1b925a5..d397849c2c6a 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -419,10 +419,10 @@ static ssize_t stm_generic_packet(struct stm_data *stm_data, struct stm_drvdata, stm); if (!(drvdata && local_read(&drvdata->mode))) - return 0; + return -EACCES; if (channel >= drvdata->numsp) - return 0; + return -EINVAL; ch_addr = (unsigned long)stm_channel_addr(drvdata, channel);