* [PATCH 0/2] Remove redundant return captures in media drivers
@ 2016-09-19 21:21 Rehas Sachdeva
2016-09-19 21:22 ` [PATCH 1/2] staging: media: bcm2048: Remove unnecessary return capture Rehas Sachdeva
2016-09-19 21:22 ` [PATCH 2/2] staging: media: davinci_vpfe: " Rehas Sachdeva
0 siblings, 2 replies; 4+ messages in thread
From: Rehas Sachdeva @ 2016-09-19 21:21 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman
Removes redundant return captures in media drivers bcm2048 and davinci_vpfe.
Rehas Sachdeva (2):
staging: media: bcm2048: Remove unnecessary return capture
staging: media: davinci_vpfe: Remove unnecessary return capture
drivers/staging/media/bcm2048/radio-bcm2048.c | 14 ++++----------
drivers/staging/media/davinci_vpfe/dm365_isif.c | 8 +++-----
2 files changed, 7 insertions(+), 15 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] staging: media: bcm2048: Remove unnecessary return capture
2016-09-19 21:21 [PATCH 0/2] Remove redundant return captures in media drivers Rehas Sachdeva
@ 2016-09-19 21:22 ` Rehas Sachdeva
2016-09-19 21:22 ` [PATCH 2/2] staging: media: davinci_vpfe: " Rehas Sachdeva
1 sibling, 0 replies; 4+ messages in thread
From: Rehas Sachdeva @ 2016-09-19 21:22 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman
Instead of storing the return value into a variable and then returning it, we
can club the two into a single return statement. This change was made using
the following semantic patch by Coccinelle:
@@
local idexpression ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
---
drivers/staging/media/bcm2048/radio-bcm2048.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
index 8dade19..ea15cc6 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -483,10 +483,8 @@ static int bcm2048_set_rds_no_lock(struct bcm2048_device *bdev, u8 rds_on)
memset(&bdev->rds_info, 0, sizeof(bdev->rds_info));
}
- err = bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_SYSTEM,
- bdev->cache_fm_rds_system);
-
- return err;
+ return bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_SYSTEM,
+ bdev->cache_fm_rds_system);
}
static int bcm2048_get_rds_no_lock(struct bcm2048_device *bdev)
@@ -1834,9 +1832,7 @@ static int bcm2048_deinit(struct bcm2048_device *bdev)
if (err < 0)
return err;
- err = bcm2048_set_power_state(bdev, BCM2048_POWER_OFF);
-
- return err;
+ return bcm2048_set_power_state(bdev, BCM2048_POWER_OFF);
}
/*
@@ -1995,9 +1991,7 @@ static ssize_t bcm2048_##prop##_read(struct device *dev, \
\
value = bcm2048_get_##prop(bdev); \
\
- value = sprintf(buf, mask "\n", value); \
- \
- return value; \
+ return sprintf(buf, mask "\n", value); \
}
#define DEFINE_SYSFS_PROPERTY(prop, signal, size, mask, check) \
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] staging: media: davinci_vpfe: Remove unnecessary return capture
2016-09-19 21:21 [PATCH 0/2] Remove redundant return captures in media drivers Rehas Sachdeva
2016-09-19 21:22 ` [PATCH 1/2] staging: media: bcm2048: Remove unnecessary return capture Rehas Sachdeva
@ 2016-09-19 21:22 ` Rehas Sachdeva
2016-09-20 5:42 ` [Outreachy kernel] " Julia Lawall
1 sibling, 1 reply; 4+ messages in thread
From: Rehas Sachdeva @ 2016-09-19 21:22 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman
Instead of storing the return value into a variable and then returning it, we
can club the two into a single return statement. This change was made using
the following semantic patch by Coccinelle:
@@
local idexpression ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
---
drivers/staging/media/davinci_vpfe/dm365_isif.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c
index ae9202d..569bcdc 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
@@ -146,9 +146,8 @@ enum v4l2_field vpfe_isif_get_fid(struct vpfe_device *vpfe_dev)
u32 field_status;
field_status = isif_read(isif->isif_cfg.base_addr, MODESET);
- field_status = (field_status >> DM365_ISIF_MDFS_OFFSET) &
- DM365_ISIF_MDFS_MASK;
- return field_status;
+ return (field_status >> DM365_ISIF_MDFS_OFFSET) &
+ DM365_ISIF_MDFS_MASK;
}
static int
@@ -594,8 +593,7 @@ isif_validate_raw_params(struct vpfe_isif_raw_config *params)
ret = isif_validate_dfc_params(¶ms->dfc);
if (ret)
return ret;
- ret = isif_validate_bclamp_params(¶ms->bclamp);
- return ret;
+ return isif_validate_bclamp_params(¶ms->bclamp);
}
static int isif_set_params(struct v4l2_subdev *sd, void *params)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/2] staging: media: davinci_vpfe: Remove unnecessary return capture
2016-09-19 21:22 ` [PATCH 2/2] staging: media: davinci_vpfe: " Rehas Sachdeva
@ 2016-09-20 5:42 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2016-09-20 5:42 UTC (permalink / raw)
To: Rehas Sachdeva
Cc: outreachy-kernel, Mauro Carvalho Chehab, Greg Kroah-Hartman
I don't understand what "return capture" means. Maybe "Merge assignment
with return".
julia
On Tue, 20 Sep 2016, Rehas Sachdeva wrote:
>
> Instead of storing the return value into a variable and then returning it, we
> can club the two into a single return statement. This change was made using
> the following semantic patch by Coccinelle:
>
> @@
> local idexpression ret;
> expression e;
> @@
>
> -ret =
> +return
> e;
> -return ret;
>
> Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
> ---
> drivers/staging/media/davinci_vpfe/dm365_isif.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c
> index ae9202d..569bcdc 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
> @@ -146,9 +146,8 @@ enum v4l2_field vpfe_isif_get_fid(struct vpfe_device *vpfe_dev)
> u32 field_status;
>
> field_status = isif_read(isif->isif_cfg.base_addr, MODESET);
> - field_status = (field_status >> DM365_ISIF_MDFS_OFFSET) &
> - DM365_ISIF_MDFS_MASK;
> - return field_status;
> + return (field_status >> DM365_ISIF_MDFS_OFFSET) &
> + DM365_ISIF_MDFS_MASK;
> }
>
> static int
> @@ -594,8 +593,7 @@ isif_validate_raw_params(struct vpfe_isif_raw_config *params)
> ret = isif_validate_dfc_params(¶ms->dfc);
> if (ret)
> return ret;
> - ret = isif_validate_bclamp_params(¶ms->bclamp);
> - return ret;
> + return isif_validate_bclamp_params(¶ms->bclamp);
> }
>
> static int isif_set_params(struct v4l2_subdev *sd, void *params)
> --
> 2.7.4
>
> --
> 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/443e4617cce56bfed713a460ee40c5ec319c1861.1474319701.git.aquannie%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-20 5:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 21:21 [PATCH 0/2] Remove redundant return captures in media drivers Rehas Sachdeva
2016-09-19 21:22 ` [PATCH 1/2] staging: media: bcm2048: Remove unnecessary return capture Rehas Sachdeva
2016-09-19 21:22 ` [PATCH 2/2] staging: media: davinci_vpfe: " Rehas Sachdeva
2016-09-20 5:42 ` [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.