Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: dan.carpenter@oracle.com (Dan Carpenter)
To: linux-arm-kernel@lists.infradead.org
Subject: [bug report] perf: xgene: Add APM X-Gene SoC Performance Monitoring Unit driver
Date: Tue, 11 Jul 2017 14:43:27 +0300	[thread overview]
Message-ID: <20170711114327.hezq3anev6bzxqz7@mwanda> (raw)

Hello Tai Nguyen,

The patch 832c927d119b: "perf: xgene: Add APM X-Gene SoC Performance
Monitoring Unit driver" from Jul 15, 2016, leads to the following
static checker warning:

	drivers/perf/xgene_pmu.c:1922 xgene_pmu_probe()
	warn: 'xgene_pmu->pcppmu_csr' is an error pointer or valid

drivers/perf/xgene_pmu.c
  1851          if (version < 0)
  1852                  return -ENODEV;
                        ^^^^^^^^^^^^^^
Good.  Direct returns are the way to go if possible.

  1853  
  1854          if (version == PCP_PMU_V3)
  1855                  xgene_pmu->ops = &xgene_pmu_v3_ops;
  1856          else
  1857                  xgene_pmu->ops = &xgene_pmu_ops;
  1858  
  1859          INIT_LIST_HEAD(&xgene_pmu->l3cpmus);
  1860          INIT_LIST_HEAD(&xgene_pmu->iobpmus);
  1861          INIT_LIST_HEAD(&xgene_pmu->mcbpmus);
  1862          INIT_LIST_HEAD(&xgene_pmu->mcpmus);
  1863  
  1864          xgene_pmu->version = version;
  1865          dev_info(&pdev->dev, "X-Gene PMU version %d\n", xgene_pmu->version);
  1866  
  1867          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1868          xgene_pmu->pcppmu_csr = devm_ioremap_resource(&pdev->dev, res);
  1869          if (IS_ERR(xgene_pmu->pcppmu_csr)) {
  1870                  dev_err(&pdev->dev, "ioremap failed for PCP PMU resource\n");
  1871                  rc = PTR_ERR(xgene_pmu->pcppmu_csr);
  1872                  goto err;
                        ^^^^^^^^
If we hit this goto then the kernel will crash.

  1873          }

    [ snip ]

  1916          /* Enable interrupt */
  1917          xgene_pmu->ops->unmask_int(xgene_pmu);
  1918  
  1919          return 0;
  1920  
  1921  err:
  1922          if (xgene_pmu->pcppmu_csr)
  1923                  devm_iounmap(&pdev->dev, xgene_pmu->pcppmu_csr);
  1924          devm_kfree(&pdev->dev, xgene_pmu);

Can't we remove all this cleanup since it's devm_ managed resources?

  1925  
  1926          return rc;
  1927  }

regards,
dan carpenter

             reply	other threads:[~2017-07-11 11:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 11:43 Dan Carpenter [this message]
2017-07-11 22:48 ` [bug report] perf: xgene: Add APM X-Gene SoC Performance Monitoring Unit driver Tai Tri Nguyen
2017-07-12  9:34   ` Mark Rutland
  -- strict thread matches above, loose matches on Subject: below --
2016-10-12 11:32 Dan Carpenter
2016-10-12 14:55 ` Mason
2016-10-12 15:23 ` Mark Rutland
2016-10-12 15:28   ` Tai Tri Nguyen

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=20170711114327.hezq3anev6bzxqz7@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox