* [PATCH] spi: lp-8841: return correct error code from probe @ 2016-02-25 11:37 Arnd Bergmann [not found] ` <1456400265-3068525-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Arnd Bergmann @ 2016-02-25 11:37 UTC (permalink / raw) To: Mark Brown Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Rob Herring, Sergei Ianovich, Arnd Bergmann, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA The spi_lp8841_rtc_probe() function misses an initialization of the return code when it fails to get its memory resource, as gcc notices: drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': drivers/spi/spi-lp8841-rtc.c:239:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the code to propagate the error from devm_ioremap_resource(). Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> Fixes: 7ecbfff6711f ("spi: master driver to enable RTC on ICPDAS LP-8841") --- drivers/spi/spi-lp8841-rtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-lp8841-rtc.c b/drivers/spi/spi-lp8841-rtc.c index 44bb69c3f1d6..faa577d282c0 100644 --- a/drivers/spi/spi-lp8841-rtc.c +++ b/drivers/spi/spi-lp8841-rtc.c @@ -217,8 +217,9 @@ spi_lp8841_rtc_probe(struct platform_device *pdev) data = spi_master_get_devdata(master); iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - data->iomem = devm_ioremap_resource(&pdev->dev, iomem); - if (IS_ERR(data->iomem)) { + data->iomem = devm_ioremap_resource(&pdev->dev, iomem); + ret = PTR_ERR_OR_ZERO(data->iomem); + if (ret) { dev_err(&pdev->dev, "failed to get IO address\n"); goto err_put_master; } -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <1456400265-3068525-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>]
* Re: [PATCH] spi: lp-8841: return correct error code from probe [not found] ` <1456400265-3068525-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> @ 2016-02-25 17:09 ` Sergei Ianovich 2016-02-26 2:47 ` Applied "spi: lp-8841: return correct error code from probe" to the spi tree Mark Brown 2016-02-27 19:32 ` [PATCH] spi: lp-8841: return correct error code from probe Sergei Ianovich 2 siblings, 0 replies; 5+ messages in thread From: Sergei Ianovich @ 2016-02-25 17:09 UTC (permalink / raw) To: Arnd Bergmann, Mark Brown Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Rob Herring, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Thu, 2016-02-25 at 12:37 +0100, Arnd Bergmann wrote: > The spi_lp8841_rtc_probe() function misses an initialization of the > return code when it fails to get its memory resource, as gcc notices: > > drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': > drivers/spi/spi-lp8841-rtc.c:239:9: error: 'ret' may be used > uninitialized in this function [-Werror=maybe-uninitialized] > > This changes the code to propagate the error from > devm_ioremap_resource(). > > Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> > Fixes: 7ecbfff6711f ("spi: master driver to enable RTC on ICPDAS LP- > 8841") Tested-by: Sergei Ianovich <ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Applied "spi: lp-8841: return correct error code from probe" to the spi tree [not found] ` <1456400265-3068525-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> 2016-02-25 17:09 ` Sergei Ianovich @ 2016-02-26 2:47 ` Mark Brown 2016-02-27 19:32 ` [PATCH] spi: lp-8841: return correct error code from probe Sergei Ianovich 2 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2016-02-26 2:47 UTC (permalink / raw) To: Arnd Bergmann, Sergei Ianovich, Mark Brown Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA The patch spi: lp-8841: return correct error code from probe has been applied to the spi tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 14a20428e2e02600195a71ad366c0caef97bf3d4 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> Date: Thu, 25 Feb 2016 12:37:40 +0100 Subject: [PATCH] spi: lp-8841: return correct error code from probe The spi_lp8841_rtc_probe() function misses an initialization of the return code when it fails to get its memory resource, as gcc notices: drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': drivers/spi/spi-lp8841-rtc.c:239:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the code to propagate the error from devm_ioremap_resource(). Fixes: 7ecbfff6711f ("spi: master driver to enable RTC on ICPDAS LP-8841") Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> Tested-by: Sergei Ianovich <ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> --- drivers/spi/spi-lp8841-rtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-lp8841-rtc.c b/drivers/spi/spi-lp8841-rtc.c index 44bb69c3f1d6..faa577d282c0 100644 --- a/drivers/spi/spi-lp8841-rtc.c +++ b/drivers/spi/spi-lp8841-rtc.c @@ -217,8 +217,9 @@ spi_lp8841_rtc_probe(struct platform_device *pdev) data = spi_master_get_devdata(master); iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - data->iomem = devm_ioremap_resource(&pdev->dev, iomem); - if (IS_ERR(data->iomem)) { + data->iomem = devm_ioremap_resource(&pdev->dev, iomem); + ret = PTR_ERR_OR_ZERO(data->iomem); + if (ret) { dev_err(&pdev->dev, "failed to get IO address\n"); goto err_put_master; } -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] spi: lp-8841: return correct error code from probe [not found] ` <1456400265-3068525-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> 2016-02-25 17:09 ` Sergei Ianovich 2016-02-26 2:47 ` Applied "spi: lp-8841: return correct error code from probe" to the spi tree Mark Brown @ 2016-02-27 19:32 ` Sergei Ianovich [not found] ` <1456601577.23036.60.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2 siblings, 1 reply; 5+ messages in thread From: Sergei Ianovich @ 2016-02-27 19:32 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Hi Arnd, On Thu, 2016-02-25 at 12:37 +0100, Arnd Bergmann wrote: > The spi_lp8841_rtc_probe() function misses an initialization of the > return code when it fails to get its memory resource, as gcc notices: > > drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': > drivers/spi/spi-lp8841-rtc.c:239:9: error: 'ret' may be used > uninitialized in this function [-Werror=maybe-uninitialized] I wasn't getting this warning when I was building the driver. This happened because -Wmaybe-uninitialized is suppressed when CONFIG_CC_OPTIMIZE_FOR_SIZE is selected (Commit e74fc973b6e531fef1fce8b101ffff05ecfb774c "Turn off -Wmaybe- uninitialized when building with -Os"). A recent gcc version like 5.3.1 doesn't seem to produce much false positives. May it make sense to revert that commit? The gcc-5.3.1 log for reference. ---8<--- $ arm-linux-gnueabi-gcc --version arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205 $ make -j 4 -s KCFLAGS=-Wmaybe-uninitialized ipc/shm.c: In function 'SyS_shmdt': ipc/shm.c:1344:59: warning: 'file' may be used uninitialized in this function [-Wmaybe-uninitialized] ((vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) && ^ ipc/shm.c:1267:15: note: 'file' was declared here struct file *file; ^ mm/vmscan.c: In function 'shrink_zone': mm/vmscan.c:2418:18: warning: 'lru_pages' may be used uninitialized in this function [-Wmaybe-uninitialized] unsigned long lru_pages; ^ drivers/gpio/gpiolib-of.c: In function 'of_gpiochip_add': drivers/gpio/gpiolib-of.c:221:7: warning: 'dflags' may be used uninitialized in this function [-Wmaybe-uninitialized] if (gpiod_hog(desc, name, lflags, dflags)) ^ drivers/gpio/gpiolib-of.c:211:19: note: 'dflags' was declared here enum gpiod_flags dflags; ^ drivers/gpio/gpiolib-of.c:221:7: warning: 'lflags' may be used uninitialized in this function [-Wmaybe-uninitialized] if (gpiod_hog(desc, name, lflags, dflags)) ^ drivers/gpio/gpiolib-of.c:210:25: note: 'lflags' was declared here enum gpio_lookup_flags lflags; ^ net/core/dev.c: In function 'validate_xmit_skb_list': net/core/dev.c:2984:15: warning: 'tail' may be used uninitialized in this function [-Wmaybe-uninitialized] tail->next = skb; ^ drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': drivers/spi/spi-lp8841-rtc.c:239:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] return ret; ^ net/sunrpc/svcauth_unix.c: In function 'unix_gid_parse': net/sunrpc/svcauth_unix.c:510:2: warning: 'gids' may be used uninitialized in this function [-Wmaybe-uninitialized] for (i = 0 ; i < gids ; i++) { ^ In file included from include/linux/sunrpc/svcauth.h:16:0, from include/linux/sunrpc/svc.h:18, from include/linux/sunrpc/svcsock.h:12, from net/sunrpc/svcauth_unix.c:6: include/linux/sunrpc/cache.h:306:9: warning: 'rv' may be used uninitialized in this function [-Wmaybe-uninitialized] return rv - boot.tv_sec; ^ include/linux/sunrpc/cache.h:298:9: note: 'rv' was declared here time_t rv; ^ net/sunrpc/svcauth_unix.c: In function 'ip_map_parse': include/linux/sunrpc/cache.h:306:9: warning: 'rv' may be used uninitialized in this function [-Wmaybe-uninitialized] return rv - boot.tv_sec; ^ include/linux/sunrpc/cache.h:298:9: note: 'rv' was declared here time_t rv; ^ In file included from net/sunrpc/cache.c:34:0: net/sunrpc/cache.c: In function 'write_flush': include/linux/sunrpc/cache.h:306:9: warning: 'rv' may be used uninitialized in this function [-Wmaybe-uninitialized] return rv - boot.tv_sec; ^ include/linux/sunrpc/cache.h:298:9: note: 'rv' was declared here time_t rv; ^ net/sunrpc/auth_gss/svcauth_gss.c: In function 'rsc_parse': net/sunrpc/auth_gss/svcauth_gss.c:456:22: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized] rsci.cred.cr_uid = make_kuid(&init_user_ns, id); ^ In file included from include/linux/sunrpc/svcauth.h:16:0, from include/linux/sunrpc/svc.h:18, from include/linux/sunrpc/auth_gss.h:17, from net/sunrpc/auth_gss/svcauth_gss.c:46: include/linux/sunrpc/cache.h:306:9: warning: 'rv' may be used uninitialized in this function [-Wmaybe-uninitialized] return rv - boot.tv_sec; ^ include/linux/sunrpc/cache.h:298:9: note: 'rv' was declared here time_t rv; ^ net/sunrpc/auth_gss/svcauth_gss.c: In function 'rsi_parse': include/linux/sunrpc/cache.h:306:9: warning: 'rv' may be used uninitialized in this function [-Wmaybe-uninitialized] return rv - boot.tv_sec; ^ include/linux/sunrpc/cache.h:298:9: note: 'rv' was declared here time_t rv; ^ ---8<--- -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <1456601577.23036.60.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] spi: lp-8841: return correct error code from probe [not found] ` <1456601577.23036.60.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-02-28 22:03 ` Arnd Bergmann 0 siblings, 0 replies; 5+ messages in thread From: Arnd Bergmann @ 2016-02-28 22:03 UTC (permalink / raw) To: Sergei Ianovich Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Saturday 27 February 2016 22:32:57 Sergei Ianovich wrote: > Hi Arnd, > > On Thu, 2016-02-25 at 12:37 +0100, Arnd Bergmann wrote: > > The spi_lp8841_rtc_probe() function misses an initialization of the > > return code when it fails to get its memory resource, as gcc notices: > > > > drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': > > drivers/spi/spi-lp8841-rtc.c:239:9: error: 'ret' may be used > > uninitialized in this function [-Werror=maybe-uninitialized] > > I wasn't getting this warning when I was building the driver. This > happened because -Wmaybe-uninitialized is suppressed when > CONFIG_CC_OPTIMIZE_FOR_SIZE is selected > (Commit e74fc973b6e531fef1fce8b101ffff05ecfb774c "Turn off -Wmaybe- > uninitialized when building with -Os"). > > A recent gcc version like 5.3.1 doesn't seem to produce much false > positives. May it make sense to revert that commit? > > The gcc-5.3.1 log for reference. I have spent a lot of time on fixing those warning messages. I still see tons of warnings even with the latest compilers when -Os (all false positives) is used, and I have a branch in which I have fixed all the ones that happen when building with -O2. I recently submitted a patch to turn CONFIG_CC_OPTIMIZE_FOR_SIZE into a choice statement that is not automatically set on an allmodconfig build, which should help here, but my patch has not yet been merged. We have similar problems with a couple of other options that drastically increase the false positive rate for these warnings (GCOV_PROFILE_ALL, PROFILE_ALL_BRANCHES, UBSAN_SANTIZE_ALL, ...), and I think our best strategy for all of these is to make sure they are not enabled in an allmodconfig build or the typical defconfigs, but also to hide the warnings if they are used in a particular config. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-28 22:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-25 11:37 [PATCH] spi: lp-8841: return correct error code from probe Arnd Bergmann [not found] ` <1456400265-3068525-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> 2016-02-25 17:09 ` Sergei Ianovich 2016-02-26 2:47 ` Applied "spi: lp-8841: return correct error code from probe" to the spi tree Mark Brown 2016-02-27 19:32 ` [PATCH] spi: lp-8841: return correct error code from probe Sergei Ianovich [not found] ` <1456601577.23036.60.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-02-28 22:03 ` Arnd Bergmann
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).