CC: [email protected]
CC: [email protected]
TO: Drew Fustini <[email protected]>
CC: Linus Walleij <[email protected]>
CC: Andy Shevchenko <[email protected]>
CC: Tony Lindgren <[email protected]>
CC: Geert Uytterhoeven <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1
commit: 6199f6becc869d30ca9394ca0f7a484bf9d598eb pinctrl: pinmux: Add 
pinmux-select debugfs file
date:   9 months ago
:::::: branch date: 16 hours ago
:::::: commit date: 9 months ago
config: x86_64-randconfig-m001-20211206 
(https://download.01.org/0day-ci/archive/20211206/[email protected]/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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
drivers/pinctrl/pinmux.c:737 pinmux_select() error: uninitialized symbol 
'groups'.
drivers/pinctrl/pinmux.c:737 pinmux_select() error: uninitialized symbol 
'num_groups'.

Old smatch warnings:
drivers/pinctrl/pinmux.c:370 pinmux_map_to_setting() error: uninitialized 
symbol 'num_groups'.
drivers/pinctrl/pinmux.c:378 pinmux_map_to_setting() error: uninitialized 
symbol 'groups'.
drivers/pinctrl/pinmux.c:386 pinmux_map_to_setting() error: uninitialized 
symbol 'groups'.
drivers/pinctrl/pinmux.c:569 pinmux_functions_show() error: uninitialized 
symbol 'num_groups'.
drivers/pinctrl/pinmux.c:570 pinmux_functions_show() error: uninitialized 
symbol 'groups'.

vim +/groups +737 drivers/pinctrl/pinmux.c

2744e8afb3b763 Linus Walleij 2011-05-02  676  
6199f6becc869d Drew Fustini  2021-03-01  677  #define PINMUX_SELECT_MAX 128
6199f6becc869d Drew Fustini  2021-03-01  678  static ssize_t 
pinmux_select(struct file *file, const char __user *user_buf,
6199f6becc869d Drew Fustini  2021-03-01  679                               
size_t len, loff_t *ppos)
6199f6becc869d Drew Fustini  2021-03-01  680  {
6199f6becc869d Drew Fustini  2021-03-01  681    struct seq_file *sfile = 
file->private_data;
6199f6becc869d Drew Fustini  2021-03-01  682    struct pinctrl_dev *pctldev = 
sfile->private;
6199f6becc869d Drew Fustini  2021-03-01  683    const struct pinmux_ops *pmxops 
= pctldev->desc->pmxops;
6199f6becc869d Drew Fustini  2021-03-01  684    const char *const *groups;
6199f6becc869d Drew Fustini  2021-03-01  685    char *buf, *gname, *fname;
6199f6becc869d Drew Fustini  2021-03-01  686    unsigned int num_groups;
6199f6becc869d Drew Fustini  2021-03-01  687    int fsel, gsel, ret;
6199f6becc869d Drew Fustini  2021-03-01  688  
6199f6becc869d Drew Fustini  2021-03-01  689    if (len > PINMUX_SELECT_MAX)
6199f6becc869d Drew Fustini  2021-03-01  690            return -ENOMEM;
6199f6becc869d Drew Fustini  2021-03-01  691  
6199f6becc869d Drew Fustini  2021-03-01  692    buf = 
kzalloc(PINMUX_SELECT_MAX, GFP_KERNEL);
6199f6becc869d Drew Fustini  2021-03-01  693    if (!buf)
6199f6becc869d Drew Fustini  2021-03-01  694            return -ENOMEM;
6199f6becc869d Drew Fustini  2021-03-01  695  
6199f6becc869d Drew Fustini  2021-03-01  696    ret = strncpy_from_user(buf, 
user_buf, PINMUX_SELECT_MAX);
6199f6becc869d Drew Fustini  2021-03-01  697    if (ret < 0)
6199f6becc869d Drew Fustini  2021-03-01  698            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  699    buf[len-1] = '\0';
6199f6becc869d Drew Fustini  2021-03-01  700  
6199f6becc869d Drew Fustini  2021-03-01  701    /* remove leading and trailing 
spaces of input buffer */
6199f6becc869d Drew Fustini  2021-03-01  702    gname = strstrip(buf);
6199f6becc869d Drew Fustini  2021-03-01  703    if (*gname == '\0') {
6199f6becc869d Drew Fustini  2021-03-01  704            ret = -EINVAL;
6199f6becc869d Drew Fustini  2021-03-01  705            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  706    }
6199f6becc869d Drew Fustini  2021-03-01  707  
6199f6becc869d Drew Fustini  2021-03-01  708    /* find a separator which is a 
spacelike character */
6199f6becc869d Drew Fustini  2021-03-01  709    for (fname = gname; 
!isspace(*fname); fname++) {
6199f6becc869d Drew Fustini  2021-03-01  710            if (*fname == '\0') {
6199f6becc869d Drew Fustini  2021-03-01  711                    ret = -EINVAL;
6199f6becc869d Drew Fustini  2021-03-01  712                    goto 
exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  713            }
6199f6becc869d Drew Fustini  2021-03-01  714    }
6199f6becc869d Drew Fustini  2021-03-01  715    *fname = '\0';
6199f6becc869d Drew Fustini  2021-03-01  716  
6199f6becc869d Drew Fustini  2021-03-01  717    /* drop extra spaces between 
function and group names */
6199f6becc869d Drew Fustini  2021-03-01  718    fname = skip_spaces(fname + 1);
6199f6becc869d Drew Fustini  2021-03-01  719    if (*fname == '\0') {
6199f6becc869d Drew Fustini  2021-03-01  720            ret = -EINVAL;
6199f6becc869d Drew Fustini  2021-03-01  721            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  722    }
6199f6becc869d Drew Fustini  2021-03-01  723  
6199f6becc869d Drew Fustini  2021-03-01  724    ret = 
pinmux_func_name_to_selector(pctldev, fname);
6199f6becc869d Drew Fustini  2021-03-01  725    if (ret < 0) {
6199f6becc869d Drew Fustini  2021-03-01  726            dev_err(pctldev->dev, 
"invalid function %s in map table\n", fname);
6199f6becc869d Drew Fustini  2021-03-01  727            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  728    }
6199f6becc869d Drew Fustini  2021-03-01  729    fsel = ret;
6199f6becc869d Drew Fustini  2021-03-01  730  
6199f6becc869d Drew Fustini  2021-03-01  731    ret = 
pmxops->get_function_groups(pctldev, fsel, &groups, &num_groups);
6199f6becc869d Drew Fustini  2021-03-01  732    if (ret) {
6199f6becc869d Drew Fustini  2021-03-01  733            dev_err(pctldev->dev, 
"no groups for function %d (%s)", fsel, fname);
6199f6becc869d Drew Fustini  2021-03-01  734            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  735    }
6199f6becc869d Drew Fustini  2021-03-01  736  
6199f6becc869d Drew Fustini  2021-03-01 @737    ret = match_string(groups, 
num_groups, gname);
6199f6becc869d Drew Fustini  2021-03-01  738    if (ret < 0) {
6199f6becc869d Drew Fustini  2021-03-01  739            dev_err(pctldev->dev, 
"invalid group %s", gname);
6199f6becc869d Drew Fustini  2021-03-01  740            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  741    }
6199f6becc869d Drew Fustini  2021-03-01  742  
6199f6becc869d Drew Fustini  2021-03-01  743    ret = 
pinctrl_get_group_selector(pctldev, gname);
6199f6becc869d Drew Fustini  2021-03-01  744    if (ret < 0) {
6199f6becc869d Drew Fustini  2021-03-01  745            dev_err(pctldev->dev, 
"failed to get group selector for %s", gname);
6199f6becc869d Drew Fustini  2021-03-01  746            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  747    }
6199f6becc869d Drew Fustini  2021-03-01  748    gsel = ret;
6199f6becc869d Drew Fustini  2021-03-01  749  
6199f6becc869d Drew Fustini  2021-03-01  750    ret = pmxops->set_mux(pctldev, 
fsel, gsel);
6199f6becc869d Drew Fustini  2021-03-01  751    if (ret) {
6199f6becc869d Drew Fustini  2021-03-01  752            dev_err(pctldev->dev, 
"set_mux() failed: %d", ret);
6199f6becc869d Drew Fustini  2021-03-01  753            goto exit_free_buf;
6199f6becc869d Drew Fustini  2021-03-01  754    }
6199f6becc869d Drew Fustini  2021-03-01  755    ret = len;
6199f6becc869d Drew Fustini  2021-03-01  756  
6199f6becc869d Drew Fustini  2021-03-01  757  exit_free_buf:
6199f6becc869d Drew Fustini  2021-03-01  758    kfree(buf);
6199f6becc869d Drew Fustini  2021-03-01  759  
6199f6becc869d Drew Fustini  2021-03-01  760    return ret;
6199f6becc869d Drew Fustini  2021-03-01  761  }
6199f6becc869d Drew Fustini  2021-03-01  762  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to