From: Mauro Carvalho Chehab <m.chehab@samsung.com>
To: Antti Palosaari <crope@iki.fi>
Cc: Andy Walls <awalls@md.metrocast.net>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH v3 18/29] [media] tuners: Don't use dynamic static allocation
Date: Thu, 07 Nov 2013 19:13:45 -0200 [thread overview]
Message-ID: <20131107191345.27ab51df@samsung.com> (raw)
In-Reply-To: <527BE215.4080702@iki.fi>
Em Thu, 07 Nov 2013 20:55:17 +0200
Antti Palosaari <crope@iki.fi> escreveu:
> Mauro,
> I just notified these are all broken. The reason is here that I2C
> adapter sets I2C operation length using sizeof(buf).
Gah!
> Please take a look of all there patches and check existing use of
> sizeof(buf).
Thanks for review!
Well not all were broken, as, on most drivers weren't using sizeof().
Anyway, I double-checked everything and fixed the drivers.
Instead of just mailbombing a 29 patch series, it seems better to just
paste here the differences from v4, and add a pointer to a git tree
with the full series of patches:
http://git.linuxtv.org/mchehab/experimental.git/shortlog/refs/heads/build-fixes-v4
Enclosed is the diff against v3.
PS.: it also addresses the issue pointed by Andy.
Regards,
Mauro
-
diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c
index 19ba66ad23fa..fb504f1e9125 100644
--- a/drivers/media/dvb-frontends/af9013.c
+++ b/drivers/media/dvb-frontends/af9013.c
@@ -58,7 +58,7 @@ static int af9013_wr_regs_i2c(struct af9013_state *priv, u8 mbox, u16 reg,
{
.addr = priv->config.i2c_addr,
.flags = 0,
- .len = sizeof(buf),
+ .len = 3 + len,
.buf = buf,
}
};
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
index 11f1555e66dc..30ee59052157 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -48,7 +48,7 @@ static int af9033_wr_regs(struct af9033_state *state, u32 reg, const u8 *val,
{
.addr = state->cfg.i2c_addr,
.flags = 0,
- .len = sizeof(buf),
+ .len = 3 + len,
.buf = buf,
}
};
diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c
index b908800b390d..7efb796c472c 100644
--- a/drivers/media/dvb-frontends/rtl2830.c
+++ b/drivers/media/dvb-frontends/rtl2830.c
@@ -39,7 +39,7 @@ static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, const u8 *val, int len)
{
.addr = priv->cfg.i2c_addr,
.flags = 0,
- .len = 1+len,
+ .len = 1 + len,
.buf = buf,
}
};
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c
index cd1e6965ac11..ff73da9365e3 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -170,7 +170,7 @@ static int rtl2832_wr(struct rtl2832_priv *priv, u8 reg, u8 *val, int len)
{
.addr = priv->cfg.i2c_addr,
.flags = 0,
- .len = 1+len,
+ .len = 1 + len,
.buf = buf,
}
};
diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c
index 97c400a4297f..93eeaf7118fd 100644
--- a/drivers/media/dvb-frontends/s5h1420.c
+++ b/drivers/media/dvb-frontends/s5h1420.c
@@ -854,7 +854,7 @@ static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c
memcpy(&m[1], msg, sizeof(struct i2c_msg) * num);
- return i2c_transfer(state->i2c, m, 1+num) == 1 + num ? num : -EIO;
+ return i2c_transfer(state->i2c, m, 1 + num) == 1 + num ? num : -EIO;
}
static struct i2c_algorithm s5h1420_tuner_i2c_algo = {
diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c
index 1d8bc2ea4b10..8ad3a57cf640 100644
--- a/drivers/media/dvb-frontends/tda10071.c
+++ b/drivers/media/dvb-frontends/tda10071.c
@@ -35,7 +35,7 @@ static int tda10071_wr_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
{
.addr = priv->cfg.demod_i2c_addr,
.flags = 0,
- .len = sizeof(buf),
+ .len = 1 + len,
.buf = buf,
}
};
@@ -76,7 +76,7 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
}, {
.addr = priv->cfg.demod_i2c_addr,
.flags = I2C_M_RD,
- .len = sizeof(buf),
+ .len = len,
.buf = buf,
}
};
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
index 87f5bcf29e90..c1f8cc6f14b2 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -327,7 +327,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
struct i2c_client *c;
u8 eedata[256];
- c = kzalloc(sizeof(*c), GFP_ATOMIC);
+ c = kzalloc(sizeof(*c), GFP_KERNEL);
strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name));
c->adapter = &cx->i2c_adap[0];
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 30192463c9e1..c9cc1232f2e5 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -32,7 +32,7 @@ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len)
{
.addr = priv->cfg->i2c_addr,
.flags = 0,
- .len = sizeof(buf),
+ .len = 1 + len,
.buf = buf,
}
};
@@ -73,7 +73,7 @@ static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len)
}, {
.addr = priv->cfg->i2c_addr,
.flags = I2C_M_RD,
- .len = sizeof(buf),
+ .len = len,
.buf = buf,
}
};
diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c
index 430fa5163ec7..3aecaf465094 100644
--- a/drivers/media/tuners/fc2580.c
+++ b/drivers/media/tuners/fc2580.c
@@ -49,7 +49,7 @@ static int fc2580_wr_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len)
{
.addr = priv->cfg->i2c_addr,
.flags = 0,
- .len = sizeof(buf),
+ .len = 1 + len,
.buf = buf,
}
};
@@ -89,7 +89,7 @@ static int fc2580_rd_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len)
}, {
.addr = priv->cfg->i2c_addr,
.flags = I2C_M_RD,
- .len = sizeof(buf),
+ .len = len,
.buf = buf,
}
};
diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c
index b3a4adf9ff8f..abe256e1f843 100644
--- a/drivers/media/tuners/tda18212.c
+++ b/drivers/media/tuners/tda18212.c
@@ -40,7 +40,7 @@ static int tda18212_wr_regs(struct tda18212_priv *priv, u8 reg, u8 *val,
{
.addr = priv->cfg->i2c_address,
.flags = 0,
- .len = sizeof(buf),
+ .len = 1 + len,
.buf = buf,
}
};
@@ -81,7 +81,7 @@ static int tda18212_rd_regs(struct tda18212_priv *priv, u8 reg, u8 *val,
}, {
.addr = priv->cfg->i2c_address,
.flags = I2C_M_RD,
- .len = sizeof(buf),
+ .len = len,
.buf = buf,
}
};
diff --git a/drivers/media/tuners/tda18218.c b/drivers/media/tuners/tda18218.c
index 7e2b32ee5349..9300e9361e3b 100644
--- a/drivers/media/tuners/tda18218.c
+++ b/drivers/media/tuners/tda18218.c
@@ -83,7 +83,7 @@ static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len)
}, {
.addr = priv->cfg->i2c_address,
.flags = I2C_M_RD,
- .len = sizeof(buf),
+ .len = reg + len,
.buf = buf,
}
};
Cheers,
Mauro
next prev parent reply other threads:[~2013-11-07 21:14 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 10:01 [PATCH v3 00/29] Fix errors/warnings with allmodconfig/allyesconfig on non-x86 archs Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 01/29] [media] tda9887: remove an warning when compiling for alpha Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 02/29] [media] radio-shark: remove a warning when CONFIG_PM is not defined Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 03/29] [media] zoran: don't build it on alpha Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 04/29] [media] cx18: struct i2c_client is too big for stack Mauro Carvalho Chehab
2013-11-06 0:19 ` Andy Walls
2013-11-05 10:01 ` [PATCH v3 05/29] [media] tef6862: fix warning on avr32 arch Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 06/29] [media] iguanair: simplify calculation of carrier delay cycles Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 07/29] [media] platform drivers: Fix build on frv arch Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 08/29] [media] radio-si470x-i2c: fix a warning on ia64 Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 09/29] [media] rc: Fir warnings on m68k arch Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 10/29] [media] uvc/lirc_serial: Fix some warnings on parisc arch Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 11/29] [media] s5h1420: Don't use dynamic static allocation Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 12/29] [media] dvb-frontends: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 13/29] " Mauro Carvalho Chehab
2013-11-05 17:00 ` Antti Palosaari
2013-11-05 10:01 ` [PATCH v3 14/29] [media] stb0899_drv: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 15/29] [media] stv0367: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 16/29] [media] stv090x: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 17/29] [media] av7110_hw: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 18/29] [media] tuners: " Mauro Carvalho Chehab
2013-11-05 17:11 ` Antti Palosaari
2013-11-07 18:55 ` Antti Palosaari
2013-11-07 21:13 ` Mauro Carvalho Chehab [this message]
2013-11-07 23:27 ` Antti Palosaari
2013-11-05 10:01 ` [PATCH v3 19/29] [media] tuner-xc2028: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 20/29] [media] cimax2: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 21/29] [media] v4l2-async: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 22/29] [media] cxusb: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 23/29] [media] dibusb-common: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 24/29] [media] dw2102: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 25/29] [media] af9015: " Mauro Carvalho Chehab
2013-11-05 17:14 ` Antti Palosaari
2013-11-05 10:01 ` [PATCH v3 26/29] [media] af9035: " Mauro Carvalho Chehab
2013-11-05 17:17 ` Antti Palosaari
2013-11-05 10:01 ` [PATCH v3 27/29] [media] mxl111sf: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 28/29] [media] lirc_zilog: " Mauro Carvalho Chehab
2013-11-05 10:01 ` [PATCH v3 29/29] [media] cx18: disable compilation on frv arch Mauro Carvalho Chehab
2013-11-05 15:17 ` [PATCH v3 00/29] Fix errors/warnings with allmodconfig/allyesconfig on non-x86 archs Hans Verkuil
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=20131107191345.27ab51df@samsung.com \
--to=m.chehab@samsung.com \
--cc=awalls@md.metrocast.net \
--cc=crope@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.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