public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sthumma@codeaurora.org
Cc: linux-scsi@vger.kernel.org
Subject: re: ufs: Add regulator enable support
Date: Thu, 2 Oct 2014 18:25:38 +0300	[thread overview]
Message-ID: <20141002152538.GA6420@mwanda> (raw)

Hello Sujit Reddy Thumma,

The patch aa4976130934: "ufs: Add regulator enable support" from Sep
25, 2014, leads to the following static checker warning:

	drivers/scsi/ufs/ufshcd-pltfrm.c:167 ufshcd_populate_vreg()
	warn: missing error code here? 'devm_kzalloc()' failed. 'ret' = '0'

drivers/scsi/ufs/ufshcd-pltfrm.c
   144  static int ufshcd_populate_vreg(struct device *dev, const char *name,
   145                  struct ufs_vreg **out_vreg)
   146  {
   147          int ret = 0;
   148          char prop_name[MAX_PROP_SIZE];
   149          struct ufs_vreg *vreg = NULL;
   150          struct device_node *np = dev->of_node;
   151  
   152          if (!np) {
   153                  dev_err(dev, "%s: non DT initialization\n", __func__);
   154                  goto out;
   155          }
   156  
   157          snprintf(prop_name, MAX_PROP_SIZE, "%s-supply", name);
   158          if (!of_parse_phandle(np, prop_name, 0)) {
   159                  dev_info(dev, "%s: Unable to find %s regulator, assuming enabled\n",
   160                                  __func__, prop_name);
   161                  goto out;
   162          }
   163  
   164          vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL);
   165          if (!vreg) {
   166                  dev_err(dev, "No memory for %s regulator\n", name);
   167                  goto out;

Don't print an error message.
Don't use a goto out.
Don't forget to set an error code.

   168          }
   169  

regards,
dan carpenter

                 reply	other threads:[~2014-10-02 15:25 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=20141002152538.GA6420@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sthumma@codeaurora.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