* [PATCH v2 0/2] fpga: Fix dead store
@ 2020-06-08 12:54 trix
2020-06-08 12:54 ` [PATCH v2 1/2] fpga: Fix dead store fpga-mgr.c trix
2020-06-08 12:54 ` [PATCH v2 2/2] fpga: Fix dead store in fpga-bridge.c trix
0 siblings, 2 replies; 5+ messages in thread
From: trix @ 2020-06-08 12:54 UTC (permalink / raw)
To: mdf; +Cc: linux-fpga, linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
repo: linux-next
tag: next-20200608
A couple of fixes for dead stores found by clang's sa tool scan-build
Main changes from v1:
Split single patch into two patch
Tom Rix (2):
fpga: Fix dead store fpga-mgr.c
fpga: Fix dead store in fpga-bridge.c
drivers/fpga/fpga-bridge.c | 6 ++----
drivers/fpga/fpga-mgr.c | 4 +---
2 files changed, 3 insertions(+), 7 deletions(-)
--
2.26.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] fpga: Fix dead store fpga-mgr.c
2020-06-08 12:54 [PATCH v2 0/2] fpga: Fix dead store trix
@ 2020-06-08 12:54 ` trix
2020-06-19 1:39 ` Moritz Fischer
2020-06-08 12:54 ` [PATCH v2 2/2] fpga: Fix dead store in fpga-bridge.c trix
1 sibling, 1 reply; 5+ messages in thread
From: trix @ 2020-06-08 12:54 UTC (permalink / raw)
To: mdf; +Cc: linux-fpga, linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
Using clang's scan-build/view this issue was flagged in fpga-mgr.c
drivers/fpga/fpga-mgr.c:585:3: warning: Value stored to 'ret' is never read [deadcode.DeadStores]
ret = id;
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/fpga/fpga-mgr.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index e05104f5e40c..f38bab01432e 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -581,10 +581,8 @@ struct fpga_manager *fpga_mgr_create(struct device *dev, const char *name,
return NULL;
id = ida_simple_get(&fpga_mgr_ida, 0, 0, GFP_KERNEL);
- if (id < 0) {
- ret = id;
+ if (id < 0)
goto error_kfree;
- }
mutex_init(&mgr->ref_mutex);
--
2.18.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] fpga: Fix dead store in fpga-bridge.c
2020-06-08 12:54 [PATCH v2 0/2] fpga: Fix dead store trix
2020-06-08 12:54 ` [PATCH v2 1/2] fpga: Fix dead store fpga-mgr.c trix
@ 2020-06-08 12:54 ` trix
2020-06-19 1:39 ` Moritz Fischer
1 sibling, 1 reply; 5+ messages in thread
From: trix @ 2020-06-08 12:54 UTC (permalink / raw)
To: mdf; +Cc: linux-fpga, linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
Using clang's scan-build/view this issue was flagged
a dead store issue in fpga-bridge.c
warning: Value stored to 'ret' is never read [deadcode.DeadStores]
ret = id;
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/fpga/fpga-bridge.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 4bab9028940a..2deccacc3aa7 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -328,7 +328,7 @@ struct fpga_bridge *fpga_bridge_create(struct device *dev, const char *name,
void *priv)
{
struct fpga_bridge *bridge;
- int id, ret = 0;
+ int id, ret;
if (!name || !strlen(name)) {
dev_err(dev, "Attempt to register with no name!\n");
@@ -340,10 +340,8 @@ struct fpga_bridge *fpga_bridge_create(struct device *dev, const char *name,
return NULL;
id = ida_simple_get(&fpga_bridge_ida, 0, 0, GFP_KERNEL);
- if (id < 0) {
- ret = id;
+ if (id < 0)
goto error_kfree;
- }
mutex_init(&bridge->mutex);
INIT_LIST_HEAD(&bridge->node);
--
2.18.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] fpga: Fix dead store fpga-mgr.c
2020-06-08 12:54 ` [PATCH v2 1/2] fpga: Fix dead store fpga-mgr.c trix
@ 2020-06-19 1:39 ` Moritz Fischer
0 siblings, 0 replies; 5+ messages in thread
From: Moritz Fischer @ 2020-06-19 1:39 UTC (permalink / raw)
To: trix; +Cc: mdf, linux-fpga, linux-kernel
On Mon, Jun 08, 2020 at 05:54:45AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Using clang's scan-build/view this issue was flagged in fpga-mgr.c
>
> drivers/fpga/fpga-mgr.c:585:3: warning: Value stored to 'ret' is never read [deadcode.DeadStores]
> ret = id;
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/fpga/fpga-mgr.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
> index e05104f5e40c..f38bab01432e 100644
> --- a/drivers/fpga/fpga-mgr.c
> +++ b/drivers/fpga/fpga-mgr.c
> @@ -581,10 +581,8 @@ struct fpga_manager *fpga_mgr_create(struct device *dev, const char *name,
> return NULL;
>
> id = ida_simple_get(&fpga_mgr_ida, 0, 0, GFP_KERNEL);
> - if (id < 0) {
> - ret = id;
> + if (id < 0)
> goto error_kfree;
> - }
>
> mutex_init(&mgr->ref_mutex);
>
> --
> 2.18.2
>
Applied to for-next,
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] fpga: Fix dead store in fpga-bridge.c
2020-06-08 12:54 ` [PATCH v2 2/2] fpga: Fix dead store in fpga-bridge.c trix
@ 2020-06-19 1:39 ` Moritz Fischer
0 siblings, 0 replies; 5+ messages in thread
From: Moritz Fischer @ 2020-06-19 1:39 UTC (permalink / raw)
To: trix; +Cc: mdf, linux-fpga, linux-kernel
On Mon, Jun 08, 2020 at 05:54:46AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Using clang's scan-build/view this issue was flagged
> a dead store issue in fpga-bridge.c
>
> warning: Value stored to 'ret' is never read [deadcode.DeadStores]
> ret = id;
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/fpga/fpga-bridge.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
> index 4bab9028940a..2deccacc3aa7 100644
> --- a/drivers/fpga/fpga-bridge.c
> +++ b/drivers/fpga/fpga-bridge.c
> @@ -328,7 +328,7 @@ struct fpga_bridge *fpga_bridge_create(struct device *dev, const char *name,
> void *priv)
> {
> struct fpga_bridge *bridge;
> - int id, ret = 0;
> + int id, ret;
>
> if (!name || !strlen(name)) {
> dev_err(dev, "Attempt to register with no name!\n");
> @@ -340,10 +340,8 @@ struct fpga_bridge *fpga_bridge_create(struct device *dev, const char *name,
> return NULL;
>
> id = ida_simple_get(&fpga_bridge_ida, 0, 0, GFP_KERNEL);
> - if (id < 0) {
> - ret = id;
> + if (id < 0)
> goto error_kfree;
> - }
>
> mutex_init(&bridge->mutex);
> INIT_LIST_HEAD(&bridge->node);
> --
> 2.18.2
>
Applied to for-next,
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-19 1:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 12:54 [PATCH v2 0/2] fpga: Fix dead store trix
2020-06-08 12:54 ` [PATCH v2 1/2] fpga: Fix dead store fpga-mgr.c trix
2020-06-19 1:39 ` Moritz Fischer
2020-06-08 12:54 ` [PATCH v2 2/2] fpga: Fix dead store in fpga-bridge.c trix
2020-06-19 1:39 ` Moritz Fischer
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).