* [PATCH] Staging: i2o: Remove assignment in if condition
@ 2015-02-18 19:01 Vatika Harlalka
2015-02-18 20:04 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Vatika Harlalka @ 2015-02-18 19:01 UTC (permalink / raw)
To: outreachy-kernel
This patch removes the assignment in an if condition to do away with
the checkpatch warning :'do not use assignment in if condition'.
Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
---
drivers/staging/i2o/bus-osm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/i2o/bus-osm.c b/drivers/staging/i2o/bus-osm.c
index 7aa0339..70b15b2 100644
--- a/drivers/staging/i2o/bus-osm.c
+++ b/drivers/staging/i2o/bus-osm.c
@@ -67,9 +67,9 @@ static ssize_t i2o_bus_store_scan(struct device *d,
const char *buf, size_t count)
{
struct i2o_device *i2o_dev = to_i2o_device(d);
- int rc;
+ int rc = i2o_bus_scan(i2o_dev);
- if ((rc = i2o_bus_scan(i2o_dev)))
+ if (rc)
osm_warn("bus scan failed %d\n", rc);
return count;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: i2o: Remove assignment in if condition
2015-02-18 19:01 [PATCH] Staging: i2o: Remove assignment in if condition Vatika Harlalka
@ 2015-02-18 20:04 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2015-02-18 20:04 UTC (permalink / raw)
To: Vatika Harlalka; +Cc: outreachy-kernel
On Thu, 19 Feb 2015, Vatika Harlalka wrote:
> This patch removes the assignment in an if condition to do away with
> the checkpatch warning :'do not use assignment in if condition'.
>
> Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
> ---
> drivers/staging/i2o/bus-osm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/i2o/bus-osm.c b/drivers/staging/i2o/bus-osm.c
> index 7aa0339..70b15b2 100644
> --- a/drivers/staging/i2o/bus-osm.c
> +++ b/drivers/staging/i2o/bus-osm.c
> @@ -67,9 +67,9 @@ static ssize_t i2o_bus_store_scan(struct device *d,
> const char *buf, size_t count)
> {
> struct i2o_device *i2o_dev = to_i2o_device(d);
> - int rc;
> + int rc = i2o_bus_scan(i2o_dev);
Unlike to_i2o_device, which is just an accessor function (a macro
actually), i2o_bus_scan does real work. I think it would be better as a
top-level statement, right before its error checking code.
julia
>
> - if ((rc = i2o_bus_scan(i2o_dev)))
> + if (rc)
> osm_warn("bus scan failed %d\n", rc);
>
> return count;
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150218190158.GA17577%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-18 20:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-18 19:01 [PATCH] Staging: i2o: Remove assignment in if condition Vatika Harlalka
2015-02-18 20:04 ` [Outreachy kernel] " Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.