kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] mfd: ene-kb3930: Add driver for ENE KB3930 Embedded Controller
Date: Thu, 10 Sep 2020 08:40:48 +0000	[thread overview]
Message-ID: <20200910084048.GA64765@mwanda> (raw)

Hello Lubomir Rintel,

The patch 753bd752e181: "mfd: ene-kb3930: Add driver for ENE KB3930
Embedded Controller" from Jul 10, 2020, leads to the following static
checker warning:

	drivers/mfd/ene-kb3930.c:165 kb3930_probe()
	warn: 'ddata->off_gpios' can also be NULL

drivers/mfd/ene-kb3930.c
   152  
   153          ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO,
   154                                     ariel_ec_cells,
   155                                     ARRAY_SIZE(ariel_ec_cells),
   156                                     NULL, 0, NULL);
   157          if (ret)
   158                  return ret;
   159  
   160          if (of_property_read_bool(np, "system-power-controller")) {
   161                  ddata->off_gpios    162                          devm_gpiod_get_array_optional(dev, "off", GPIOD_IN);

The devm_gpiod_get_array_optional() function can return NULL in the
sitation where the optional array is not there.  It's not an error
because it's an optional thing, but there is also no valid pointer to
return.  So because it's not an error pointer, or a valid pointer then
it's NULL.

   163                  if (IS_ERR(ddata->off_gpios))
   164                          return PTR_ERR(ddata->off_gpios);
   165                  if (ddata->off_gpios->ndescs < 2) {
   166                          dev_err(dev, "invalid off-gpios property\n");
   167                          return -EINVAL;
   168                  }
   169          }
   170  
   171          if (ddata->off_gpios) {
   172                  register_restart_handler(&kb3930_restart_nb);
   173                  if (!pm_power_off)
   174                          pm_power_off = kb3930_pm_power_off;
   175          }
   176  
   177          return 0;

regards,
dan carpenter

                 reply	other threads:[~2020-09-10  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200910084048.GA64765@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.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).