mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Konrad Dybcio <konradybcio@gmail.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>
Subject: [kbuild] drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c:120:2: warning: Local variable ret shadows outer variable
Date: Wed, 5 Aug 2020 16:44:21 +0300	[thread overview]
Message-ID: <20200805134421.GP5493@kadam> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2324d50d051ec0f14a548e78554fb02513d6dcef
commit: 02ed76b6da0710a9d24f36a4a9800a68d7edb9a7 drivers: drm: panel: Add ASUS TM5P5 NT35596 panel driver

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

cppcheck warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c:120:2: warning: Local variable ret shadows outer variable [shadowVar]
    dsi_dcs_write_seq(dsi, 0x4f, 0x01);
    ^
   drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c:105:6: note: Shadowed declaration
    int ret;
        ^
   drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c:120:2: note: Shadow variable
    dsi_dcs_write_seq(dsi, 0x4f, 0x01);
    ^

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=02ed76b6da0710a9d24f36a4a9800a68d7edb9a7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 02ed76b6da0710a9d24f36a4a9800a68d7edb9a7
vim +120 drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c

02ed76b6da0710a Konrad Dybcio 2020-05-06  101  static int tm5p5_nt35596_off(struct tm5p5_nt35596 *ctx)
02ed76b6da0710a Konrad Dybcio 2020-05-06  102  {
02ed76b6da0710a Konrad Dybcio 2020-05-06  103  	struct mipi_dsi_device *dsi = ctx->dsi;
02ed76b6da0710a Konrad Dybcio 2020-05-06  104  	struct device *dev = &dsi->dev;
02ed76b6da0710a Konrad Dybcio 2020-05-06  105  	int ret;
02ed76b6da0710a Konrad Dybcio 2020-05-06  106  
02ed76b6da0710a Konrad Dybcio 2020-05-06  107  	ret = mipi_dsi_dcs_set_display_off(dsi);
02ed76b6da0710a Konrad Dybcio 2020-05-06  108  	if (ret < 0) {
02ed76b6da0710a Konrad Dybcio 2020-05-06  109  		dev_err(dev, "Failed to set display off: %d\n", ret);
02ed76b6da0710a Konrad Dybcio 2020-05-06  110  		return ret;
02ed76b6da0710a Konrad Dybcio 2020-05-06  111  	}
02ed76b6da0710a Konrad Dybcio 2020-05-06  112  	msleep(60);
02ed76b6da0710a Konrad Dybcio 2020-05-06  113  
02ed76b6da0710a Konrad Dybcio 2020-05-06  114  	ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
02ed76b6da0710a Konrad Dybcio 2020-05-06  115  	if (ret < 0) {
02ed76b6da0710a Konrad Dybcio 2020-05-06  116  		dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
02ed76b6da0710a Konrad Dybcio 2020-05-06  117  		return ret;
02ed76b6da0710a Konrad Dybcio 2020-05-06  118  	}
02ed76b6da0710a Konrad Dybcio 2020-05-06  119  
02ed76b6da0710a Konrad Dybcio 2020-05-06 @120  	dsi_dcs_write_seq(dsi, 0x4f, 0x01);

It's a really bad idea to hide a return inside a macro.  It will lead to
all sorts of locking and error handling bugs.

02ed76b6da0710a Konrad Dybcio 2020-05-06  121  
02ed76b6da0710a Konrad Dybcio 2020-05-06  122  	return 0;
02ed76b6da0710a Konrad Dybcio 2020-05-06  123  }

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

                 reply	other threads:[~2020-08-05 16:18 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=20200805134421.GP5493@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=konradybcio@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=sam@ravnborg.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

all inboxes | Powered by JetHome®