From patchwork Thu Nov 10 18:18:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 81730 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp869580qge; Thu, 10 Nov 2016 10:19:14 -0800 (PST) X-Received: by 10.98.144.213 with SMTP id q82mr12302604pfk.56.1478801953947; Thu, 10 Nov 2016 10:19:13 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h70si6206414pfc.168.2016.11.10.10.19.13; Thu, 10 Nov 2016 10:19:13 -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 S1755827AbcKJSTA (ORCPT + 27 others); Thu, 10 Nov 2016 13:19:00 -0500 Received: from mail-it0-f46.google.com ([209.85.214.46]:38777 "EHLO mail-it0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755782AbcKJSS5 (ORCPT ); Thu, 10 Nov 2016 13:18:57 -0500 Received: by mail-it0-f46.google.com with SMTP id q124so58836233itd.1 for ; Thu, 10 Nov 2016 10:18:57 -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=OASgm1SsqskDroHUxagxBitj2XrWk0Ir0gVZw6M6ZJICWtdGxOQodGwLJtpORboI2B DcZBQ1CJoY2+w1+JUY/887FaF+uwjXIRaOttPsEzndi+6TevETB1g4OjbJNKuHYqyJk/ rryWRAIkWpeMzbxKY2MTvhyjzHyQ28KPlMlpQ= 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=JVMWIaTl79Do92teosEK8DEGri6z6eJQYXxrgQ6kwmFNFnXhEMSI8E3/qfo8vprf7A DP1SamdVE0TXa7Y8ym1Koi+3RhPuMzwoyYjrsHuVit7rZD8KBiAzXhaiy3ISYiNUMUXI g8TRBPn61pBIZD54NMGvljlc1nm0zczwQoVD+geRM7GLHBpAMyNKOk6WEdS7U80mH/cJ 275Ga8fLe+gu5TQJEf7WE+bBaLWEV4R7zJ4hv3YEVQI2w3M7xKl5m12/hIa6c2nLIjb0 cYwpgkmXS1/R9MdE9PFXHdMBYeytcgvrGYEU9Cc3NbZLyV/pUl3y8zq9zRRqEZlyXK5z y5Sw== X-Gm-Message-State: ABUngvc26ORnpRRGWv/EkACeBC4NtR8EZD5kg9Z2Y6wt3e5oEH0jlkeJIvGxD7kLOtuDb/pA X-Received: by 10.36.237.3 with SMTP id r3mr5176609ith.76.1478801937111; Thu, 10 Nov 2016 10:18:57 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 62sm10377930itl.19.2016.11.10.10.18.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 10:18:56 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] coresight: stm: return error code instead of zero in .packet() Date: Thu, 10 Nov 2016 11:18:47 -0700 Message-Id: <1478801934-26904-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478801934-26904-1-git-send-email-mathieu.poirier@linaro.org> References: <1478801934-26904-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);