linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tty:tty-testing 96/222] drivers/tty/serial/max310x.c:1430 max310x_probe() warn: 's->clk' not released on lines: 1296.
@ 2021-06-25 12:11 Dan Carpenter
  2021-06-25 15:39 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-06-25 12:11 UTC (permalink / raw)
  To: kbuild, Andy Shevchenko; +Cc: lkp, kbuild-all, linux-serial, Greg Kroah-Hartman

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
head:   5607fa6c3da3189de1bac356c73bc4fcaf4c0234
commit: d4d6f03c4fb3a91dadfe147b47edd40e4d7e4d36 [96/222] serial: max310x: Try to get crystal clock rate from property
config: x86_64-randconfig-m001-20210622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/tty/serial/max310x.c:1430 max310x_probe() warn: 's->clk' not released on lines: 1296.

vim +1430 drivers/tty/serial/max310x.c
  1285          }
  1286  
  1287          ret = clk_prepare_enable(s->clk);
  1288          if (ret)
  1289                  return ret;
  1290  
  1291          freq = clk_get_rate(s->clk);
  1292          if (freq == 0)
  1293                  freq = uartclk;
  1294          if (freq == 0) {
  1295                  dev_err(dev, "Cannot get clock rate\n");
  1296                  return -EINVAL;

goto out_clk?

  1297          }
  1298  
  1299          if (xtal) {
  1300                  fmin = 1000000;
  1301                  fmax = 4000000;
  1302          } else {
  1303                  fmin = 500000;
  1304                  fmax = 35000000;
  1305          }
  1306  
  1307          /* Check frequency limits */
  1308          if (freq < fmin || freq > fmax) {
  1309                  ret = -ERANGE;
  1310                  goto out_clk;
  1311          }
  1312  
  1313          s->regmap = regmap;
  1314          s->devtype = devtype;
  1315          dev_set_drvdata(dev, s);
  1316  
  1317          /* Check device to ensure we are talking to what we expect */
  1318          ret = devtype->detect(dev);
  1319          if (ret)
  1320                  goto out_clk;
  1321  
  1322          for (i = 0; i < devtype->nr; i++) {
  1323                  unsigned int offs = i << 5;
  1324  
  1325                  /* Reset port */
  1326                  regmap_write(s->regmap, MAX310X_MODE2_REG + offs,

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

* Re: [tty:tty-testing 96/222] drivers/tty/serial/max310x.c:1430 max310x_probe() warn: 's->clk' not released on lines: 1296.
  2021-06-25 12:11 [tty:tty-testing 96/222] drivers/tty/serial/max310x.c:1430 max310x_probe() warn: 's->clk' not released on lines: 1296 Dan Carpenter
@ 2021-06-25 15:39 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2021-06-25 15:39 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kbuild, lkp, kbuild-all, linux-serial, Greg Kroah-Hartman

On Fri, Jun 25, 2021 at 03:11:35PM +0300, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
> head:   5607fa6c3da3189de1bac356c73bc4fcaf4c0234
> commit: d4d6f03c4fb3a91dadfe147b47edd40e4d7e4d36 [96/222] serial: max310x: Try to get crystal clock rate from property
> config: x86_64-randconfig-m001-20210622 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> drivers/tty/serial/max310x.c:1430 max310x_probe() warn: 's->clk' not released on lines: 1296.
> 
> vim +1430 drivers/tty/serial/max310x.c
>   1285          }
>   1286  
>   1287          ret = clk_prepare_enable(s->clk);
>   1288          if (ret)
>   1289                  return ret;
>   1290  
>   1291          freq = clk_get_rate(s->clk);
>   1292          if (freq == 0)
>   1293                  freq = uartclk;
>   1294          if (freq == 0) {
>   1295                  dev_err(dev, "Cannot get clock rate\n");
>   1296                  return -EINVAL;
> 
> goto out_clk?

Right. I moved the code after the clk_prepare_enable() call and forgot to
change the error path handling, thanks!

I have just sent a fix.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2021-06-25 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 12:11 [tty:tty-testing 96/222] drivers/tty/serial/max310x.c:1430 max310x_probe() warn: 's->clk' not released on lines: 1296 Dan Carpenter
2021-06-25 15:39 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).