From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)
Date: Sun, 31 Mar 2024 20:48:11 +0800 [thread overview]
Message-ID: <202403312030.QYCgiAey-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: a6bd6c9333397f5a0e2667d4d82fef8c970108f2
commit: d60bc2995732489766cbe650fc367e036ff6a0e0 [1128/2532] pwm: Add a struct device to struct pwm_chip
:::::: branch date: 3 days ago
:::::: commit date: 6 days ago
config: m68k-randconfig-r071-20240326 (https://download.01.org/0day-ci/archive/20240331/202403312030.QYCgiAey-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202403312030.QYCgiAey-lkp@intel.com/
smatch warnings:
drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528)
vim +/pwm +1530 drivers/pwm/core.c
8138d2ddbcca2a Thierry Reding 2012-03-26 1521
8138d2ddbcca2a Thierry Reding 2012-03-26 1522 /**
8138d2ddbcca2a Thierry Reding 2012-03-26 1523 * pwm_put() - release a PWM device
8138d2ddbcca2a Thierry Reding 2012-03-26 1524 * @pwm: PWM device
8138d2ddbcca2a Thierry Reding 2012-03-26 1525 */
8138d2ddbcca2a Thierry Reding 2012-03-26 1526 void pwm_put(struct pwm_device *pwm)
8138d2ddbcca2a Thierry Reding 2012-03-26 1527 {
d60bc299573248 Uwe Kleine-König 2024-03-17 @1528 struct pwm_chip *chip = pwm->chip;
d60bc299573248 Uwe Kleine-König 2024-03-17 1529
8138d2ddbcca2a Thierry Reding 2012-03-26 @1530 if (!pwm)
8138d2ddbcca2a Thierry Reding 2012-03-26 1531 return;
8138d2ddbcca2a Thierry Reding 2012-03-26 1532
8138d2ddbcca2a Thierry Reding 2012-03-26 1533 mutex_lock(&pwm_lock);
8138d2ddbcca2a Thierry Reding 2012-03-26 1534
8138d2ddbcca2a Thierry Reding 2012-03-26 1535 if (!test_and_clear_bit(PWMF_REQUESTED, &pwm->flags)) {
e50d3523ff4564 Sachin Kamat 2012-08-10 1536 pr_warn("PWM device already freed\n");
8138d2ddbcca2a Thierry Reding 2012-03-26 1537 goto out;
8138d2ddbcca2a Thierry Reding 2012-03-26 1538 }
8138d2ddbcca2a Thierry Reding 2012-03-26 1539
d60bc299573248 Uwe Kleine-König 2024-03-17 1540 if (chip->ops->free)
8138d2ddbcca2a Thierry Reding 2012-03-26 1541 pwm->chip->ops->free(pwm->chip, pwm);
8138d2ddbcca2a Thierry Reding 2012-03-26 1542
8138d2ddbcca2a Thierry Reding 2012-03-26 1543 pwm->label = NULL;
8138d2ddbcca2a Thierry Reding 2012-03-26 1544
d60bc299573248 Uwe Kleine-König 2024-03-17 1545 put_device(&chip->dev);
d60bc299573248 Uwe Kleine-König 2024-03-17 1546
d60bc299573248 Uwe Kleine-König 2024-03-17 1547 module_put(chip->owner);
8138d2ddbcca2a Thierry Reding 2012-03-26 1548 out:
8138d2ddbcca2a Thierry Reding 2012-03-26 1549 mutex_unlock(&pwm_lock);
8138d2ddbcca2a Thierry Reding 2012-03-26 1550 }
8138d2ddbcca2a Thierry Reding 2012-03-26 1551 EXPORT_SYMBOL_GPL(pwm_put);
8138d2ddbcca2a Thierry Reding 2012-03-26 1552
:::::: The code at line 1530 was first introduced by commit
:::::: 8138d2ddbcca2a100482dac390133f83c5a60f94 pwm: Add table-based lookup for static mappings
:::::: TO: Thierry Reding <thierry.reding@avionic-design.de>
:::::: CC: Thierry Reding <thierry.reding@avionic-design.de>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2024-03-31 12:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-31 12:48 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-02 14:13 [linux-next:master 1128/2532] drivers/pwm/core.c:1530 pwm_put() warn: variable dereferenced before check 'pwm' (see line 1528) Dan Carpenter
2024-04-02 15:11 ` Uwe Kleine-König
2024-04-30 11:08 ` Dan Carpenter
2024-04-30 16:59 ` Uwe Kleine-König
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=202403312030.QYCgiAey-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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.