All of lore.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Todor Tomov <todor.tomov@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] [media] camss-csid: Reduce the scope for a variable in csid_set_power()
Date: Sat, 23 Sep 2017 21:45:20 +0200	[thread overview]
Message-ID: <8c356ba6-62a3-033d-f3d6-75e1bab1814f@users.sourceforge.net> (raw)
In-Reply-To: <168ff884-7ace-c548-7f90-d4f2910bb337@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 23 Sep 2017 21:00:30 +0200

Move the definition for the local variable "dev" into an if branch
so that the corresponding setting will only be performed if it was
selected by the parameter "on" of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/qcom/camss-8x16/camss-csid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/camss-8x16/camss-csid.c b/drivers/media/platform/qcom/camss-8x16/camss-csid.c
index 92d4dc6b4a66..ffda0fbfe4d8 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-csid.c
+++ b/drivers/media/platform/qcom/camss-8x16/camss-csid.c
@@ -317,10 +317,10 @@ static int csid_reset(struct csid_device *csid)
 static int csid_set_power(struct v4l2_subdev *sd, int on)
 {
 	struct csid_device *csid = v4l2_get_subdevdata(sd);
-	struct device *dev = to_device_index(csid, csid->id);
 	int ret;
 
 	if (on) {
+		struct device *dev = to_device_index(csid, csid->id);
 		u32 hw_version;
 
 		ret = regulator_enable(csid->vdda);
-- 
2.14.1

WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Todor Tomov <todor.tomov@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] [media] camss-csid: Reduce the scope for a variable in csid_set_power()
Date: Sat, 23 Sep 2017 19:45:20 +0000	[thread overview]
Message-ID: <8c356ba6-62a3-033d-f3d6-75e1bab1814f@users.sourceforge.net> (raw)
In-Reply-To: <168ff884-7ace-c548-7f90-d4f2910bb337@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 23 Sep 2017 21:00:30 +0200

Move the definition for the local variable "dev" into an if branch
so that the corresponding setting will only be performed if it was
selected by the parameter "on" of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/qcom/camss-8x16/camss-csid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/camss-8x16/camss-csid.c b/drivers/media/platform/qcom/camss-8x16/camss-csid.c
index 92d4dc6b4a66..ffda0fbfe4d8 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss-csid.c
+++ b/drivers/media/platform/qcom/camss-8x16/camss-csid.c
@@ -317,10 +317,10 @@ static int csid_reset(struct csid_device *csid)
 static int csid_set_power(struct v4l2_subdev *sd, int on)
 {
 	struct csid_device *csid = v4l2_get_subdevdata(sd);
-	struct device *dev = to_device_index(csid, csid->id);
 	int ret;
 
 	if (on) {
+		struct device *dev = to_device_index(csid, csid->id);
 		u32 hw_version;
 
 		ret = regulator_enable(csid->vdda);
-- 
2.14.1


  parent reply	other threads:[~2017-09-23 19:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-23 19:43 [PATCH 0/3] [media] camss-csid: Fine-tuning for three function implementations SF Markus Elfring
2017-09-23 19:43 ` SF Markus Elfring
2017-09-23 19:44 ` [PATCH 1/3] [media] camss-csid: Use common error handling code in csid_set_power() SF Markus Elfring
2017-09-23 19:44   ` SF Markus Elfring
2017-09-23 19:45 ` SF Markus Elfring [this message]
2017-09-23 19:45   ` [PATCH 2/3] [media] camss-csid: Reduce the scope for a variable " SF Markus Elfring
2017-09-23 19:46 ` [PATCH 3/3] [media] camss-csid: Adjust a null pointer check in two functions SF Markus Elfring
2017-09-23 19:46   ` SF Markus Elfring

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=8c356ba6-62a3-033d-f3d6-75e1bab1814f@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=todor.tomov@linaro.org \
    /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 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.