mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf: arm_spe: remove unnecessary zero check
@ 2020-02-26  4:25 luanshi
  2020-03-09 10:52 ` Mark Rutland
  0 siblings, 1 reply; 2+ messages in thread
From: luanshi @ 2020-02-26  4:25 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland; +Cc: linux-arm-kernel, linux-kernel, luanshi

The "nr_pages" variable has been checked before, it can't be zero, so a check here would be useless.

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
---
 drivers/perf/arm_spe_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index 4e4984a..b72c048 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -831,7 +831,7 @@ static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages,
 	 * parts and give userspace a fighting chance of getting some
 	 * useful data out of it.
 	 */
-	if (!nr_pages || (snapshot && (nr_pages & 1)))
+	if (snapshot && (nr_pages & 1))
 		return NULL;
 
 	if (cpu == -1)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf: arm_spe: remove unnecessary zero check
  2020-02-26  4:25 [PATCH] perf: arm_spe: remove unnecessary zero check luanshi
@ 2020-03-09 10:52 ` Mark Rutland
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2020-03-09 10:52 UTC (permalink / raw)
  To: luanshi; +Cc: Will Deacon, linux-arm-kernel, linux-kernel

On Wed, Feb 26, 2020 at 12:25:06PM +0800, luanshi wrote:
> The "nr_pages" variable has been checked before, it can't be zero, so a check here would be useless.
> 
> Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>

As the commit message states, a  done:

| /* We need at least two pages for this to work. */
| if (nr_pages < 2)
|         return NULL;

... so this looks sensible to me:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  drivers/perf/arm_spe_pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
> index 4e4984a..b72c048 100644
> --- a/drivers/perf/arm_spe_pmu.c
> +++ b/drivers/perf/arm_spe_pmu.c
> @@ -831,7 +831,7 @@ static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages,
>  	 * parts and give userspace a fighting chance of getting some
>  	 * useful data out of it.
>  	 */
> -	if (!nr_pages || (snapshot && (nr_pages & 1)))
> +	if (snapshot && (nr_pages & 1))
>  		return NULL;
>  
>  	if (cpu == -1)
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-09 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26  4:25 [PATCH] perf: arm_spe: remove unnecessary zero check luanshi
2020-03-09 10:52 ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®