From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org, Bhumika Goyal <bhumirks@gmail.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Johan Hovold <johan@kernel.org>,
Julia Lawall <Julia.Lawall@lip6.fr>,
Matthias Schwarzott <zzam@gentoo.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Oleh Kravchenko <oleg@kaa.org.ua>, Peter Rosin <peda@axentia.se>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/8] [media] cx231xx: Delete eight error messages for a failed memory allocation
Date: Sun, 17 Sep 2017 22:16:50 +0200 [thread overview]
Message-ID: <dd754a24-d113-2b6b-5f5c-01e9e6454ad9@users.sourceforge.net> (raw)
In-Reply-To: <f2c1ca56-ecdc-318c-f18f-9bef6c670ffb@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 17 Sep 2017 17:43:47 +0200
Omit extra messages for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/usb/cx231xx/cx231xx-core.c | 14 ++------------
drivers/media/usb/cx231xx/cx231xx-dvb.c | 7 ++-----
drivers/media/usb/cx231xx/cx231xx-vbi.c | 11 +----------
3 files changed, 5 insertions(+), 27 deletions(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
index f372ad3917a8..d9f4ae50e869 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -1038,12 +1038,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
- if (!dev->video_mode.isoc_ctl.urb) {
- dev_err(dev->dev,
- "cannot alloc memory for usb buffers\n");
+ if (!dev->video_mode.isoc_ctl.urb)
return -ENOMEM;
- }
dev->video_mode.isoc_ctl.transfer_buffer =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->video_mode.isoc_ctl.transfer_buffer) {
- dev_err(dev->dev,
- "cannot allocate memory for usbtransfer\n");
kfree(dev->video_mode.isoc_ctl.urb);
@@ -1173,12 +1168,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
- if (!dev->video_mode.bulk_ctl.urb) {
- dev_err(dev->dev,
- "cannot alloc memory for usb buffers\n");
+ if (!dev->video_mode.bulk_ctl.urb)
return -ENOMEM;
- }
dev->video_mode.bulk_ctl.transfer_buffer =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->video_mode.bulk_ctl.transfer_buffer) {
- dev_err(dev->dev,
- "cannot allocate memory for usbtransfer\n");
kfree(dev->video_mode.bulk_ctl.urb);
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index c18bb33e060e..248b62e2099c 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -618,9 +618,6 @@ static int dvb_init(struct cx231xx *dev)
-
- if (dvb == NULL) {
- dev_info(dev->dev,
- "cx231xx_dvb: memory allocation failed\n");
+ if (!dvb)
return -ENOMEM;
- }
+
dev->dvb = dvb;
dev->cx231xx_set_analog_freq = cx231xx_set_analog_freq;
dev->cx231xx_reset_analog_tuner = cx231xx_reset_analog_tuner;
diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c
index 76e901920f6f..9c27db16db2a 100644
--- a/drivers/media/usb/cx231xx/cx231xx-vbi.c
+++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c
@@ -420,12 +420,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
- if (!dev->vbi_mode.bulk_ctl.urb) {
- dev_err(dev->dev,
- "cannot alloc memory for usb buffers\n");
+ if (!dev->vbi_mode.bulk_ctl.urb)
return -ENOMEM;
- }
dev->vbi_mode.bulk_ctl.transfer_buffer =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->vbi_mode.bulk_ctl.transfer_buffer) {
- dev_err(dev->dev,
- "cannot allocate memory for usbtransfer\n");
kfree(dev->vbi_mode.bulk_ctl.urb);
@@ -453,8 +448,4 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) {
- dev_err(dev->dev,
- "unable to allocate %i bytes for transfer buffer %i%s\n",
- sb_size, i,
- in_interrupt() ? " while in int" : "");
cx231xx_uninit_vbi_isoc(dev);
return -ENOMEM;
}
--
2.14.1
next prev parent reply other threads:[~2017-09-17 20:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-17 20:15 [PATCH 0/8] [media] Cx231xx: Adjustments for several function implementations SF Markus Elfring
2017-09-17 20:16 ` SF Markus Elfring [this message]
2017-09-17 20:17 ` [PATCH 2/8] [media] cx231xx: Adjust 56 checks for null pointers SF Markus Elfring
2017-09-17 20:18 ` [PATCH 3/8] [media] cx231xx: Improve six size determinations SF Markus Elfring
2017-09-17 20:19 ` [PATCH 4/8] [media] cx231xx: Delete an unnecessary variable initialisation in dvb_init() SF Markus Elfring
2017-09-17 20:21 ` [PATCH 5/8] [media] cx231xx: Use common error handling code " SF Markus Elfring
2017-09-17 20:22 ` [PATCH 6/8] [media] cx231xx: Use common error handling code in read_eeprom() SF Markus Elfring
2017-09-17 20:23 ` [PATCH 7/8] [media] cx231xx: Delete an unnecessary variable initialisation " SF Markus Elfring
2017-09-17 20:24 ` [PATCH 8/8] [media] cx231xx: Use common error handling code in cx231xx_load_firmware() 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=dd754a24-d113-2b6b-5f5c-01e9e6454ad9@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=Julia.Lawall@lip6.fr \
--cc=bhumirks@gmail.com \
--cc=hans.verkuil@cisco.com \
--cc=johan@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=oleg@kaa.org.ua \
--cc=peda@axentia.se \
--cc=sakari.ailus@linux.intel.com \
--cc=zzam@gentoo.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®