From: Andrzej Hajda <a.hajda@samsung.com>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Sylwester Nawrocki <s.nawrocki@samsung.com>
Subject: Re: [PATCH] s5k5baf: remove unnecessary static in s5k5baf_get_selection()
Date: Mon, 10 Jul 2017 14:25:20 +0200 [thread overview]
Message-ID: <81c29fdb-77ad-37bb-6353-0fee2d782189@samsung.com> (raw)
In-Reply-To: <20170705180729.GA10314@embeddedgus>
On 05.07.2017 20:07, Gustavo A. R. Silva wrote:
> Remove unnecessary static on local variable rtype.
> Such variable is initialized before being used,
> on every execution path throughout the function.
> The static has no benefit and, removing it reduces
> the code size.
>
> This issue was detected using Coccinelle and the following semantic patch:
>
> @bad exists@
> position p;
> identifier x;
> type T;
> @@
>
> static T x@p;
> ...
> x = <+...x...+>
>
> @@
> identifier x;
> expression e;
> type T;
> position p != bad.p;
> @@
>
> -static
> T x@p;
> ... when != x
> when strict
> ?x = e;
>
> In the following log you can see the difference in the code size. Also,
> there is a significant difference in the bss segment. This log is the
> output of the size command, before and after the code change:
>
> before:
> text data bss dec hex filename
> 27765 5656 320 33741 83cd drivers/media/i2c/s5k5baf.o
>
> after:
> text data bss dec hex filename
> 27733 5600 256 33589 8335 drivers/media/i2c/s5k5baf.o
>
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
--
Regards
Andrzej
> ---
> drivers/media/i2c/s5k5baf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
> index 962051b..f01722d 100644
> --- a/drivers/media/i2c/s5k5baf.c
> +++ b/drivers/media/i2c/s5k5baf.c
> @@ -1374,7 +1374,7 @@ static int s5k5baf_get_selection(struct v4l2_subdev *sd,
> struct v4l2_subdev_pad_config *cfg,
> struct v4l2_subdev_selection *sel)
> {
> - static enum selection_rect rtype;
> + enum selection_rect rtype;
> struct s5k5baf *state = to_s5k5baf(sd);
>
> rtype = s5k5baf_get_sel_rect(sel->pad, sel->target);
prev parent reply other threads:[~2017-07-10 12:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170705180734epcas5p3b658b32b6b0f5f0c77b7f068fb020d77@epcas5p3.samsung.com>
2017-07-05 18:07 ` Gustavo A. R. Silva
2017-07-10 12:25 ` Andrzej Hajda [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81c29fdb-77ad-37bb-6353-0fee2d782189@samsung.com \
--to=a.hajda@samsung.com \
--cc=garsilva@embeddedor.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=s.nawrocki@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®