mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tolga Ceylan <tolga.ceylan@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	Dilek Uzulmez <dilekuzulmez@gmail.com>,
	Ning Zhou <zhou.ning.gd@gmail.com>,
	Gulsah Kose <gulsah.1004@gmail.com>, Tom Gundersen <teg@jklm.no>,
	Scott Weir <sjw0410@gmail.com>,
	Monam Agarwal <monamagarwal123@gmail.com>,
	Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>,
	Uma Sharma <uma.sharma523@gmail.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Daniel Ngu <daniel.dy.ngu@gmail.com>,
	Robert Nachlinger <robert.nachlinger@gmail.com>,
	Ebru Akagunduz <ebru.akagunduz@gmail.com>,
	Octavian Purdila <octavian.purdila@intel.com>,
	Kiran Padwal <kiran.padwal21@gmail.com>,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Aybuke Ozdemir <aybuke.147@gmail.com>,
	Cihangir Akturk <cakturk@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Abel Moyo <abelmoyo.ab@gmail.com>,
	Himangi Saraogi <himangi774@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: Tolga Ceylan <tolga.ceylan@gmail.com>
Subject: [PATCH 4/5] Staging: gdm724x: code style improvements
Date: Fri, 13 Feb 2015 21:32:23 -0800	[thread overview]
Message-ID: <1423891944-26824-4-git-send-email-tolga.ceylan@gmail.com> (raw)
In-Reply-To: <1423891944-26824-1-git-send-email-tolga.ceylan@gmail.com>

In memory allocation (kzalloc, kmalloc) arguments
sizeof(struct foo) rewritten as sizeof(*foo_obj).

Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com>
---
 drivers/staging/gdm724x/gdm_mux.c |  8 ++++----
 drivers/staging/gdm724x/gdm_tty.c |  2 +-
 drivers/staging/gdm724x/gdm_usb.c | 10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c
index b025a49..522f3cd 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -67,7 +67,7 @@ static struct mux_tx *alloc_mux_tx(int len)
 {
 	struct mux_tx *t = NULL;
 
-	t = kzalloc(sizeof(struct mux_tx), GFP_ATOMIC);
+	t = kzalloc(sizeof(*t), GFP_ATOMIC);
 	if (!t)
 		return NULL;
 
@@ -96,7 +96,7 @@ static struct mux_rx *alloc_mux_rx(void)
 {
 	struct mux_rx *r = NULL;
 
-	r = kzalloc(sizeof(struct mux_rx), GFP_KERNEL);
+	r = kzalloc(sizeof(*r), GFP_KERNEL);
 	if (!r)
 		return NULL;
 
@@ -529,11 +529,11 @@ static int gdm_mux_probe(struct usb_interface *intf,
 	if (bInterfaceNumber != 2)
 		return -ENODEV;
 
-	mux_dev = kzalloc(sizeof(struct mux_dev), GFP_KERNEL);
+	mux_dev = kzalloc(sizeof(*mux_dev), GFP_KERNEL);
 	if (!mux_dev)
 		return -ENOMEM;
 
-	tty_dev = kzalloc(sizeof(struct tty_dev), GFP_KERNEL);
+	tty_dev = kzalloc(sizeof(*tty_dev), GFP_KERNEL);
 	if (!tty_dev) {
 		ret = -ENOMEM;
 		goto err_free_mux;
diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c
index b593525..3b9bf07 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -226,7 +226,7 @@ int register_lte_tty_device(struct tty_dev *tty_dev, struct device *device)
 
 	for (i = 0; i < TTY_MAX_COUNT; i++) {
 
-		gdm = kmalloc(sizeof(struct gdm), GFP_KERNEL);
+		gdm = kmalloc(sizeof(*gdm), GFP_KERNEL);
 		if (!gdm)
 			return -ENOMEM;
 
diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index 36fe1b4..e81b266 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -92,7 +92,7 @@ static struct usb_tx *alloc_tx_struct(int len)
 	struct usb_tx *t = NULL;
 	int ret = 0;
 
-	t = kzalloc(sizeof(struct usb_tx), GFP_ATOMIC);
+	t = kzalloc(sizeof(*t), GFP_ATOMIC);
 	if (!t) {
 		ret = -ENOMEM;
 		goto out;
@@ -125,7 +125,7 @@ static struct usb_tx_sdu *alloc_tx_sdu_struct(void)
 {
 	struct usb_tx_sdu *t_sdu;
 
-	t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_KERNEL);
+	t_sdu = kzalloc(sizeof(*t_sdu), GFP_KERNEL);
 	if (!t_sdu)
 		return NULL;
 
@@ -183,7 +183,7 @@ static struct usb_rx *alloc_rx_struct(void)
 	struct usb_rx *r = NULL;
 	int ret = 0;
 
-	r = kmalloc(sizeof(struct usb_rx), GFP_KERNEL);
+	r = kmalloc(sizeof(*r), GFP_KERNEL);
 	if (!r) {
 		ret = -ENOMEM;
 		goto out;
@@ -829,11 +829,11 @@ static int gdm_usb_probe(struct usb_interface *intf,
 		return -ENODEV;
 	}
 
-	phy_dev = kzalloc(sizeof(struct phy_dev), GFP_KERNEL);
+	phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
 	if (!phy_dev)
 		return -ENOMEM;
 
-	udev = kzalloc(sizeof(struct lte_udev), GFP_KERNEL);
+	udev = kzalloc(sizeof(*udev), GFP_KERNEL);
 	if (!udev) {
 		ret = -ENOMEM;
 		goto err_udev;
-- 
2.3.0


  parent reply	other threads:[~2015-02-14  5:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-14  5:32 [PATCH 1/5] " Tolga Ceylan
2015-02-14  5:32 ` [PATCH 2/5] " Tolga Ceylan
2015-02-14  5:32 ` [PATCH 3/5] " Tolga Ceylan
2015-02-14  5:32 ` Tolga Ceylan [this message]
2015-02-14  5:32 ` [PATCH 5/5] " Tolga Ceylan
2015-03-07  0:51 ` [PATCH 1/5] " Greg Kroah-Hartman

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=1423891944-26824-4-git-send-email-tolga.ceylan@gmail.com \
    --to=tolga.ceylan@gmail.com \
    --cc=abelmoyo.ab@gmail.com \
    --cc=aybuke.147@gmail.com \
    --cc=cakturk@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel.dy.ngu@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=dilekuzulmez@gmail.com \
    --cc=ebru.akagunduz@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gulsah.1004@gmail.com \
    --cc=himangi774@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=khoroshilov@ispras.ru \
    --cc=kiran.padwal21@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monamagarwal123@gmail.com \
    --cc=octavian.purdila@intel.com \
    --cc=peter.p.waskiewicz.jr@intel.com \
    --cc=robert.nachlinger@gmail.com \
    --cc=sjw0410@gmail.com \
    --cc=teg@jklm.no \
    --cc=uma.sharma523@gmail.com \
    --cc=zhou.ning.gd@gmail.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

Powered by JetHome