From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
Bumwoo Lee <bw365.lee@samsung.com>
Subject: [PATCH v2 5/5] extcon: Drop unneeded assignments
Date: Wed, 5 Apr 2023 18:27:45 +0300 [thread overview]
Message-ID: <20230405152745.24959-6-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230405152745.24959-1-andriy.shevchenko@linux.intel.com>
In one case the assignment is duplicative, in the other,
it's better to move it into the loop — the user of it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bumwoo Lee <bw365.lee@samsung.com>
---
drivers/extcon/extcon.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 50c5fd454488..88ce0656d23c 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -245,7 +245,7 @@ static DEFINE_MUTEX(extcon_dev_list_lock);
static int check_mutually_exclusive(struct extcon_dev *edev, u32 new_state)
{
- int i = 0;
+ int i;
if (!edev->mutually_exclusive)
return 0;
@@ -1246,7 +1246,7 @@ static int extcon_alloc_groups(struct extcon_dev *edev)
*/
int extcon_dev_register(struct extcon_dev *edev)
{
- int ret, index = 0;
+ int ret, index;
ret = create_extcon_class();
if (ret < 0)
@@ -1255,7 +1255,7 @@ int extcon_dev_register(struct extcon_dev *edev)
if (!edev || !edev->supported_cable)
return -EINVAL;
- for (; edev->supported_cable[index] != EXTCON_NONE; index++);
+ for (index = 0; edev->supported_cable[index] != EXTCON_NONE; index++);
edev->max_supported = index;
if (index > SUPPORTED_CABLE_MAX) {
--
2.40.0.1.gaa8946217a0b
next prev parent reply other threads:[~2023-04-05 15:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 15:27 [PATCH v2 0/5] extcon: Core cleanups and documentation fixes Andy Shevchenko
2023-04-05 15:27 ` [PATCH v2 1/5] extcon: Make the allocation and freeing to be private calls Andy Shevchenko
2023-04-06 19:19 ` Chanwoo Choi
2023-04-05 15:27 ` [PATCH v2 2/5] extcon: Get rid of not really used name field in struct extcon_dev Andy Shevchenko
2023-04-06 19:26 ` Chanwoo Choi
2023-04-11 11:37 ` Andy Shevchenko
2023-04-11 11:42 ` Andy Shevchenko
2023-04-05 15:27 ` [PATCH v2 3/5] extcon: Use unique number for the extcon device ID Andy Shevchenko
2023-04-05 15:27 ` [PATCH v2 4/5] extcon: Use sizeof(*pointer) instead of sizeof(type) Andy Shevchenko
2023-04-06 19:33 ` Chanwoo Choi
2023-04-05 15:27 ` Andy Shevchenko [this message]
2023-04-06 19:35 ` [PATCH v2 5/5] extcon: Drop unneeded assignments Chanwoo Choi
2023-04-11 11:43 ` Andy Shevchenko
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=20230405152745.24959-6-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bw365.lee@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@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