From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v4 2/2] pinctrl: pinmux: Add pinmux-select debugfs file
Date: Thu, 11 Feb 2021 12:32:10 +0800 [thread overview]
Message-ID: <202102111250.AgSVZSnJ-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8258 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210210222851.232374-3-drew@beagleboard.org>
References: <20210210222851.232374-3-drew@beagleboard.org>
TO: Drew Fustini <drew@beagleboard.org>
TO: Linus Walleij <linus.walleij@linaro.org>
TO: linux-gpio(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org
TO: Tony Lindgren <tony@atomide.com>
TO: Andy Shevchenko <andy.shevchenko@gmail.com>
TO: Alexandre Belloni <alexandre.belloni@bootlin.com>
TO: Geert Uytterhoeven <geert@linux-m68k.org>
TO: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
TO: Jason Kridner <jkridner@beagleboard.org>
TO: Robert Nelson <robertcnelson@beagleboard.org>
Hi Drew,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on pinctrl/devel]
[also build test WARNING on v5.11-rc7 next-20210125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Drew-Fustini/pinctrl-pinmux-Add-pinmux-select-debugfs-file/20210211-063617
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: x86_64-randconfig-m001-20210211 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 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/pinctrl/pinmux.c:764 pinmux_select() warn: possible memory leak of 'gname'
vim +/gname +764 drivers/pinctrl/pinmux.c
2744e8afb3b763 Linus Walleij 2011-05-02 675
f878efc17642ce Drew Fustini 2021-02-10 676 #define PINMUX_MAX_NAME 64
f878efc17642ce Drew Fustini 2021-02-10 677 static ssize_t pinmux_select(struct file *file, const char __user *user_buf,
f878efc17642ce Drew Fustini 2021-02-10 678 size_t len, loff_t *ppos)
f878efc17642ce Drew Fustini 2021-02-10 679 {
f878efc17642ce Drew Fustini 2021-02-10 680 struct seq_file *sfile = file->private_data;
f878efc17642ce Drew Fustini 2021-02-10 681 struct pinctrl_dev *pctldev = sfile->private;
f878efc17642ce Drew Fustini 2021-02-10 682 const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
f878efc17642ce Drew Fustini 2021-02-10 683 const char *const *groups;
f878efc17642ce Drew Fustini 2021-02-10 684 char *buf, *fname, *gname;
f878efc17642ce Drew Fustini 2021-02-10 685 unsigned int num_groups;
f878efc17642ce Drew Fustini 2021-02-10 686 int fsel, gsel, ret;
f878efc17642ce Drew Fustini 2021-02-10 687
f878efc17642ce Drew Fustini 2021-02-10 688 if (len > (PINMUX_MAX_NAME * 2)) {
f878efc17642ce Drew Fustini 2021-02-10 689 dev_err(pctldev->dev, "write too big for buffer");
f878efc17642ce Drew Fustini 2021-02-10 690 return -EINVAL;
f878efc17642ce Drew Fustini 2021-02-10 691 }
f878efc17642ce Drew Fustini 2021-02-10 692
f878efc17642ce Drew Fustini 2021-02-10 693 buf = kzalloc(PINMUX_MAX_NAME * 2, GFP_KERNEL);
f878efc17642ce Drew Fustini 2021-02-10 694 if (!buf)
f878efc17642ce Drew Fustini 2021-02-10 695 return -ENOMEM;
f878efc17642ce Drew Fustini 2021-02-10 696
f878efc17642ce Drew Fustini 2021-02-10 697 fname = kzalloc(PINMUX_MAX_NAME, GFP_KERNEL);
f878efc17642ce Drew Fustini 2021-02-10 698 if (!fname) {
f878efc17642ce Drew Fustini 2021-02-10 699 ret = -ENOMEM;
f878efc17642ce Drew Fustini 2021-02-10 700 goto free_buf;
f878efc17642ce Drew Fustini 2021-02-10 701 }
f878efc17642ce Drew Fustini 2021-02-10 702
f878efc17642ce Drew Fustini 2021-02-10 703 gname = kzalloc(PINMUX_MAX_NAME, GFP_KERNEL);
f878efc17642ce Drew Fustini 2021-02-10 704 if (!buf) {
f878efc17642ce Drew Fustini 2021-02-10 705 ret = -ENOMEM;
f878efc17642ce Drew Fustini 2021-02-10 706 goto free_fname;
f878efc17642ce Drew Fustini 2021-02-10 707 }
f878efc17642ce Drew Fustini 2021-02-10 708
f878efc17642ce Drew Fustini 2021-02-10 709 ret = strncpy_from_user(buf, user_buf, PINMUX_MAX_NAME * 2);
f878efc17642ce Drew Fustini 2021-02-10 710 if (ret < 0) {
f878efc17642ce Drew Fustini 2021-02-10 711 dev_err(pctldev->dev, "failed to copy buffer from userspace");
f878efc17642ce Drew Fustini 2021-02-10 712 goto free_gname;
f878efc17642ce Drew Fustini 2021-02-10 713 }
f878efc17642ce Drew Fustini 2021-02-10 714 buf[len-1] = '\0';
f878efc17642ce Drew Fustini 2021-02-10 715
f878efc17642ce Drew Fustini 2021-02-10 716 ret = sscanf(buf, "%s %s", fname, gname);
f878efc17642ce Drew Fustini 2021-02-10 717 if (ret != 2) {
f878efc17642ce Drew Fustini 2021-02-10 718 dev_err(pctldev->dev, "expected format: <function-name> <group-name>");
f878efc17642ce Drew Fustini 2021-02-10 719 goto free_gname;
f878efc17642ce Drew Fustini 2021-02-10 720 }
f878efc17642ce Drew Fustini 2021-02-10 721
f878efc17642ce Drew Fustini 2021-02-10 722 fsel = pinmux_func_name_to_selector(pctldev, fname);
f878efc17642ce Drew Fustini 2021-02-10 723 if (fsel < 0) {
f878efc17642ce Drew Fustini 2021-02-10 724 dev_err(pctldev->dev, "invalid function %s in map table\n", fname);
f878efc17642ce Drew Fustini 2021-02-10 725 ret = -EINVAL;
f878efc17642ce Drew Fustini 2021-02-10 726 goto free_gname;
f878efc17642ce Drew Fustini 2021-02-10 727 }
f878efc17642ce Drew Fustini 2021-02-10 728
f878efc17642ce Drew Fustini 2021-02-10 729 ret = pmxops->get_function_groups(pctldev, fsel, &groups, &num_groups);
f878efc17642ce Drew Fustini 2021-02-10 730 if (ret) {
f878efc17642ce Drew Fustini 2021-02-10 731 dev_err(pctldev->dev, "no groups for function %d (%s)", fsel, fname);
f878efc17642ce Drew Fustini 2021-02-10 732 goto free_gname;
f878efc17642ce Drew Fustini 2021-02-10 733
f878efc17642ce Drew Fustini 2021-02-10 734 }
f878efc17642ce Drew Fustini 2021-02-10 735
f878efc17642ce Drew Fustini 2021-02-10 736 ret = match_string(groups, num_groups, gname);
f878efc17642ce Drew Fustini 2021-02-10 737 if (ret < 0) {
f878efc17642ce Drew Fustini 2021-02-10 738 dev_err(pctldev->dev, "invalid group %s", gname);
f878efc17642ce Drew Fustini 2021-02-10 739 goto free_gname;
f878efc17642ce Drew Fustini 2021-02-10 740 }
f878efc17642ce Drew Fustini 2021-02-10 741
f878efc17642ce Drew Fustini 2021-02-10 742 ret = pinctrl_get_group_selector(pctldev, gname);
f878efc17642ce Drew Fustini 2021-02-10 743 if (ret < 0) {
f878efc17642ce Drew Fustini 2021-02-10 744 dev_err(pctldev->dev, "failed to get group selectorL %s", gname);
f878efc17642ce Drew Fustini 2021-02-10 745 goto free_gname;
f878efc17642ce Drew Fustini 2021-02-10 746 }
f878efc17642ce Drew Fustini 2021-02-10 747 gsel = ret;
f878efc17642ce Drew Fustini 2021-02-10 748
f878efc17642ce Drew Fustini 2021-02-10 749 ret = pmxops->set_mux(pctldev, fsel, gsel);
f878efc17642ce Drew Fustini 2021-02-10 750 if (ret) {
f878efc17642ce Drew Fustini 2021-02-10 751 dev_err(pctldev->dev, "set_mux() failed: %d", ret);
f878efc17642ce Drew Fustini 2021-02-10 752 goto free_gname;
f878efc17642ce Drew Fustini 2021-02-10 753 }
f878efc17642ce Drew Fustini 2021-02-10 754
f878efc17642ce Drew Fustini 2021-02-10 755 return len;
f878efc17642ce Drew Fustini 2021-02-10 756
f878efc17642ce Drew Fustini 2021-02-10 757 free_gname:
f878efc17642ce Drew Fustini 2021-02-10 758 devm_kfree(pctldev->dev, gname);
f878efc17642ce Drew Fustini 2021-02-10 759 free_fname:
f878efc17642ce Drew Fustini 2021-02-10 760 devm_kfree(pctldev->dev, fname);
f878efc17642ce Drew Fustini 2021-02-10 761 free_buf:
f878efc17642ce Drew Fustini 2021-02-10 762 devm_kfree(pctldev->dev, buf);
f878efc17642ce Drew Fustini 2021-02-10 763
f878efc17642ce Drew Fustini 2021-02-10 @764 return ret;
f878efc17642ce Drew Fustini 2021-02-10 765 }
f878efc17642ce Drew Fustini 2021-02-10 766
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37886 bytes --]
next reply other threads:[~2021-02-11 4:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-11 4:32 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-02-10 22:28 [PATCH v4 0/2] pinctrl: pinmux: Add pinmux-select debugfs file Drew Fustini
2021-02-10 22:28 ` [PATCH v4 2/2] " Drew Fustini
2021-02-11 7:11 ` Dan Carpenter
2021-02-11 7:24 ` Joe Perches
2021-02-11 7:39 ` Dan Carpenter
2021-02-12 3:35 ` Drew Fustini
2021-02-17 8:18 ` Dan Carpenter
2021-02-11 8:09 ` Geert Uytterhoeven
2021-02-11 9:53 ` Andy Shevchenko
2021-02-12 3:39 ` Drew Fustini
2021-02-12 3:37 ` Drew Fustini
2021-02-11 12:00 ` Dan Carpenter
2021-02-12 3:41 ` Drew Fustini
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=202102111250.AgSVZSnJ-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.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 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.