From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
Arvind Yadav <arvind.yadav.cs@gmail.com>,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] [media] dvb-ttusb-budget: Improve two size determinations in ttusb_probe()
Date: Wed, 20 Sep 2017 21:12:39 +0200 [thread overview]
Message-ID: <404d5faa-432b-9649-4b9e-f0cdf1c18338@users.sourceforge.net> (raw)
In-Reply-To: <1ad3c3ce-3738-fee1-2ee5-37142fa1bc70@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 20 Sep 2017 20:46:11 +0200
* The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix an affected source code place.
* Replace the specification of data structures by variable references
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
index 38394c9ecc67..fef3c8554e91 100644
--- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
@@ -1657,7 +1657,8 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV;
- if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL)))
+ ttusb = kzalloc(sizeof(*ttusb), GFP_KERNEL);
+ if (!ttusb)
return -ENOMEM;
ttusb->dev = udev;
@@ -1692,7 +1693,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
ttusb->adapter.priv = ttusb;
/* i2c */
- memset(&ttusb->i2c_adap, 0, sizeof(struct i2c_adapter));
+ memset(&ttusb->i2c_adap, 0, sizeof(ttusb->i2c_adap));
strcpy(ttusb->i2c_adap.name, "TTUSB DEC");
i2c_set_adapdata(&ttusb->i2c_adap, ttusb);
--
2.14.1
next prev parent reply other threads:[~2017-09-20 19:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 19:10 [PATCH 0/3] [media] TTUSB DVB Budget: Fine-tuning for three function implementations SF Markus Elfring
2017-09-20 19:11 ` [PATCH 1/3] [media] dvb-ttusb-budget: Use common error handling code in ttusb_probe() SF Markus Elfring
2017-09-20 19:12 ` SF Markus Elfring [this message]
2017-09-20 19:13 ` [PATCH 3/3] [media] dvb-ttusb-budget: Adjust eight checks for null pointers 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=404d5faa-432b-9649-4b9e-f0cdf1c18338@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=arvind.yadav.cs@gmail.com \
--cc=garsilva@embeddedor.com \
--cc=hans.verkuil@cisco.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.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 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®