All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tuanphan@os.amperecomputing.com
Cc: linux-arm-kernel@lists.infradead.org
Subject: [bug report] driver/perf: Add PMU driver for the ARM DMC-620 memory controller
Date: Mon, 7 Dec 2020 20:56:48 +0300	[thread overview]
Message-ID: <X85s4Haz+LBzhKnF@mwanda> (raw)

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-12-07 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 17:56 Dan Carpenter [this message]
2020-12-09 20:57 ` [bug report] driver/perf: Add PMU driver for the ARM DMC-620 memory controller Tuan Phan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X85s4Haz+LBzhKnF@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=tuanphan@os.amperecomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.