Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300120 > unrolled thread

[PATCH 0/3] NFC-mei_phy: Fine-tuning for two function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-01-02 22:00 +0100
Last post2016-01-02 22:00 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 0/3] NFC-mei_phy: Fine-tuning for two function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 22:00 +0100
    [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 22:00 +0100
      Re: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect() Julian Calaby <julian.calaby@gmail.com> - 2016-01-03 00:50 +0100
        Re: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-03 08:10 +0100
          Re: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect() Joe Perches <joe@perches.com> - 2016-01-03 08:40 +0100
    [PATCH 2/3] NFC-mei_phy: Refactoring for mei_nfc_if_version() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 22:00 +0100

#1300120 — [PATCH 0/3] NFC-mei_phy: Fine-tuning for two function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-02 22:00 +0100
Subject[PATCH 0/3] NFC-mei_phy: Fine-tuning for two function implementations
Message-ID<qMBrk-4rN-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jan 2016 21:47:30 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Refactoring for mei_nfc_connect()
  Refactoring for mei_nfc_if_version()
  Delete an unnecessary variable initialisation in mei_nfc_if_version()

 drivers/nfc/mei_phy.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1300121 — [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-02 22:00 +0100
Subject[PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()
Message-ID<qMBrk-4rN-5@gated-at.bofh.it>
In reply to#1300120
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jan 2016 21:21:24 +0100

This issue was detected by using the Coccinelle software.

Adjust jump targets according to the current Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/nfc/mei_phy.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c
index 83deda4..8e3a69f 100644
--- a/drivers/nfc/mei_phy.c
+++ b/drivers/nfc/mei_phy.c
@@ -173,8 +173,8 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
 
 	reply = kzalloc(connect_resp_length, GFP_KERNEL);
 	if (!reply) {
-		kfree(cmd);
-		return -ENOMEM;
+		r = -ENOMEM;
+		goto free_cmd;
 	}
 
 	connect_resp = (struct mei_nfc_connect_resp *)reply->data;
@@ -189,7 +189,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
 	r = mei_cldev_send(phy->cldev, (u8 *)cmd, connect_length);
 	if (r < 0) {
 		pr_err("Could not send connect cmd %d\n", r);
-		goto err;
+		goto free_reply;
 	}
 
 	bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply,
@@ -197,7 +197,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
 	if (bytes_recv < 0) {
 		r = bytes_recv;
 		pr_err("Could not read connect response %d\n", r);
-		goto err;
+		goto free_reply;
 	}
 
 	MEI_DUMP_NFC_HDR("connect reply", &reply->hdr);
@@ -210,11 +210,10 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
 		connect_resp->me_hotfix, connect_resp->me_build);
 
 	r = 0;
-
-err:
+free_reply:
 	kfree(reply);
+free_cmd:
 	kfree(cmd);
-
 	return r;
 }
 
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300149 — Re: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()

FromJulian Calaby <julian.calaby@gmail.com>
Date2016-01-03 00:50 +0100
SubjectRe: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()
Message-ID<qME5Q-6aU-7@gated-at.bofh.it>
In reply to#1300121
Hi Markus,

On Sun, Jan 3, 2016 at 7:54 AM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 2 Jan 2016 21:21:24 +0100
>
> This issue was detected by using the Coccinelle software.
>
> Adjust jump targets according to the current Linux coding style convention.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/nfc/mei_phy.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c
> index 83deda4..8e3a69f 100644
> --- a/drivers/nfc/mei_phy.c
> +++ b/drivers/nfc/mei_phy.c
> @@ -173,8 +173,8 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
>
>         reply = kzalloc(connect_resp_length, GFP_KERNEL);
>         if (!reply) {
> -               kfree(cmd);
> -               return -ENOMEM;
> +               r = -ENOMEM;
> +               goto free_cmd;
>         }
>
>         connect_resp = (struct mei_nfc_connect_resp *)reply->data;
> @@ -189,7 +189,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
>         r = mei_cldev_send(phy->cldev, (u8 *)cmd, connect_length);
>         if (r < 0) {
>                 pr_err("Could not send connect cmd %d\n", r);
> -               goto err;
> +               goto free_reply;
>         }
>
>         bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply,
> @@ -197,7 +197,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
>         if (bytes_recv < 0) {
>                 r = bytes_recv;
>                 pr_err("Could not read connect response %d\n", r);
> -               goto err;
> +               goto free_reply;
>         }
>
>         MEI_DUMP_NFC_HDR("connect reply", &reply->hdr);
> @@ -210,11 +210,10 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
>                 connect_resp->me_hotfix, connect_resp->me_build);
>
>         r = 0;
> -
> -err:
> +free_reply:
>         kfree(reply);
> +free_cmd:
>         kfree(cmd);
> -

Why are you deleting the two blank lines here?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300264 — Re: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-03 08:10 +0100
SubjectRe: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()
Message-ID<qMKXE-2eY-1@gated-at.bofh.it>
In reply to#1300149
>>         r = 0;
>> -
>> -err:
>> +free_reply:
>>         kfree(reply);
>> +free_cmd:
>>         kfree(cmd);
>> -
> 
> Why are you deleting the two blank lines here?

Can they be unnecessary at this source code place
according to the Linux coding style convention?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300267 — Re: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()

FromJoe Perches <joe@perches.com>
Date2016-01-03 08:40 +0100
SubjectRe: [PATCH 1/3] NFC-mei_phy: Refactoring for mei_nfc_connect()
Message-ID<qMLqG-2pY-3@gated-at.bofh.it>
In reply to#1300264
On Sun, 2016-01-03 at 08:00 +0100, SF Markus Elfring wrote:
> > >         r = 0;
> > > -
> > > -err:
> > > +free_reply:
> > >         kfree(reply);
> > > +free_cmd:
> > >         kfree(cmd);
> > > -
> > 
> > Why are you deleting the two blank lines here?
> 
> Can they be unnecessary at this source code place
> according to the Linux coding style convention?

As far as I know, there's no linux specific accepted
convention for blank lines preceding labels.

My personal preference is for a blank line before a
new block, but not before the second and subsequent
labels in an error handling block.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300122 — [PATCH 2/3] NFC-mei_phy: Refactoring for mei_nfc_if_version()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-02 22:00 +0100
Subject[PATCH 2/3] NFC-mei_phy: Refactoring for mei_nfc_if_version()
Message-ID<qMBrk-4rN-11@gated-at.bofh.it>
In reply to#1300120
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jan 2016 21:33:04 +0100

Rename a jump label according to the current Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/nfc/mei_phy.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c
index 8e3a69f..3c74028 100644
--- a/drivers/nfc/mei_phy.c
+++ b/drivers/nfc/mei_phy.c
@@ -136,7 +136,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy)
 	if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
 		pr_err("Could not read IF version\n");
 		r = -EIO;
-		goto err;
+		goto free_reply;
 	}
 
 	version = (struct mei_nfc_if_version *)reply->data;
@@ -144,8 +144,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy)
 	phy->fw_ivn = version->fw_ivn;
 	phy->vendor_id = version->vendor_id;
 	phy->radio_type = version->radio_type;
-
-err:
+free_reply:
 	kfree(reply);
 	return r;
 }
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web