[bug report] driver/perf: Add PMU driver for the ARM DMC-620 memory controller

Tuan Phan tuanphan at amperemail.onmicrosoft.com
Wed Dec 9 15:57:05 EST 2020


Thanks Dan, I will look at it and provide a patch.

> On Dec 7, 2020, at 9:56 AM, Dan Carpenter <dan.carpenter at oracle.com> wrote:
> 
> Hello Tuan Phan,
> 
> The patch 53c218da220c: "driver/perf: Add PMU driver for the ARM
> DMC-620 memory controller" from Nov 4, 2020, leads to the following
> static checker warning:
> 
> 	drivers/perf/arm_dmc620_pmu.c:612 dmc620_pmu_cpu_teardown()
> 	error: potential NULL dereference 'irq'.
> 
> drivers/perf/arm_dmc620_pmu.c
>   604  static int dmc620_pmu_cpu_teardown(unsigned int cpu,
>   605                                     struct hlist_node *node)
>   606  {
>   607          struct dmc620_pmu_irq *irq;
>   608          struct dmc620_pmu *dmc620_pmu;
>   609          unsigned int target;
>   610  
>   611          irq = hlist_entry_safe(node, struct dmc620_pmu_irq, node);
>   612          if (cpu != irq->cpu)
> 
> There isn't any point to using hlist_entry_safe() instead of hlist_entry()
> when we're not going to check for NULL returns.
> 
>   613                  return 0;
>   614  
>   615          target = cpumask_any_but(cpu_online_mask, cpu);
>   616          if (target >= nr_cpu_ids)
>   617                  return 0;
>   618  
>   619          /* We're only reading, but this isn't the place to be involving RCU */
>   620          mutex_lock(&dmc620_pmu_irqs_lock);
>   621          list_for_each_entry(dmc620_pmu, &irq->pmus_node, pmus_node)
>   622                  perf_pmu_migrate_context(&dmc620_pmu->pmu, irq->cpu, target);
>   623          mutex_unlock(&dmc620_pmu_irqs_lock);
> 
> regards,
> dan carpenter




More information about the linux-arm-kernel mailing list