linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: shawn.guo@linaro.org
Cc: linux-gpio@vger.kernel.org
Subject: [bug report] pinctrl: add ZTE ZX pinctrl driver support
Date: Thu, 29 Jun 2017 12:51:52 +0300	[thread overview]
Message-ID: <20170629095152.ahkv55cjj26c3nmk@mwanda> (raw)

Hello Shawn Guo,

The patch cbff0c4d27f4: "pinctrl: add ZTE ZX pinctrl driver support"
from Apr 24, 2017, leads to the following static checker warning:

	drivers/pinctrl/zte/pinctrl-zx.c:338 zx_pinctrl_build_state()
	warn: passing devm_ allocated variable to kfree. 'functions'

drivers/pinctrl/zte/pinctrl-zx.c
   293  
   294          /* Build function list from pin mux functions */
   295          functions = devm_kzalloc(&pdev->dev, info->npins * sizeof(*functions),
                ^^^^^^^^^^^^^^^^^^^^^^^^

   296                                   GFP_KERNEL);
   297          if (!functions)
   298                  return -ENOMEM;
   299  
   300          nfunctions = 0;
   301          for (i = 0; i < info->npins; i++) {
   302                  const struct pinctrl_pin_desc *pindesc = info->pins + i;
   303                  struct zx_pin_data *data = pindesc->drv_data;
   304                  struct zx_mux_desc *mux;
   305  
   306                  /* Reserved pins do not have a drv_data at all */
   307                  if (!data)
   308                          continue;
   309  
   310                  /* Loop over all muxes for the pin */
   311                  mux = data->muxes;
   312                  while (mux->name) {
   313                          struct function_desc *func = functions;
   314  
   315                          /* Search function list for given mux */
   316                          while (func->name) {
   317                                  if (strcmp(mux->name, func->name) == 0) {
   318                                          /* Function exists */
   319                                          func->num_group_names++;
   320                                          break;
   321                                  }
   322                                  func++;
   323                          }
   324  
   325                          if (!func->name) {
   326                                  /* New function */
   327                                  func->name = mux->name;
   328                                  func->num_group_names = 1;
   329                                  radix_tree_insert(&pctldev->pin_function_tree,
   330                                                    nfunctions++, func);
   331                          }
   332  
   333                          mux++;
   334                  }
   335          }
   336  
   337          pctldev->num_functions = nfunctions;
   338          functions = krealloc(functions, nfunctions * sizeof(*functions),
                                     ^^^^^^^^^
Not allowed.

   339                               GFP_KERNEL);
   340  
   341          /* Find pin groups for every single function */
   342          for (i = 0; i < info->npins; i++) {

regards,
dan carpenter

             reply	other threads:[~2017-06-29  9:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29  9:51 Dan Carpenter [this message]
2017-06-29 14:30 ` [bug report] pinctrl: add ZTE ZX pinctrl driver support Shawn Guo
2017-07-03 14:55   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2017-06-30  7:53 Dan Carpenter

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=20170629095152.ahkv55cjj26c3nmk@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=shawn.guo@linaro.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;
as well as URLs for NNTP newsgroup(s).