lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200805134421.GP5493@kadam>
Date:   Wed, 5 Aug 2020 16:44:21 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Konrad Dybcio <konradybcio@...il.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Sam Ravnborg <sam@...nborg.org>
Subject: [kbuild] drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c:120:2:
 warning: Local variable ret shadows outer variable

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@...el.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@...ts.01.org
To unsubscribe send an email to kbuild-leave@...ts.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ