All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: dvb: qt1010, change i2c read buffer from stack, to kernel space
@ 2021-10-07 12:29 rkardell
  2021-12-06 15:01 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 2+ messages in thread
From: rkardell @ 2021-10-07 12:29 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, linux-kernel

Solve problem with initialization of Mega Sky 580 USB DVB (and other 
using mt352), error when reading i2c id.


Signed-off-by: rkl099 <rkardell@mida.se>
---
  drivers/media/tuners/qt1010.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/tuners/qt1010.c b/drivers/media/tuners/qt1010.c
index 3853a3d43..1bc0756f7 100644
--- a/drivers/media/tuners/qt1010.c
+++ b/drivers/media/tuners/qt1010.c
@@ -11,18 +11,22 @@
  /* read single register */
  static int qt1010_readreg(struct qt1010_priv *priv, u8 reg, u8 *val)
  {
+    u8 *b1=kmalloc(1,GFP_KERNEL);
         struct i2c_msg msg[2] = {
                 { .addr = priv->cfg->i2c_address,
                   .flags = 0, .buf = &reg, .len = 1 },
                 { .addr = priv->cfg->i2c_address,
-                 .flags = I2C_M_RD, .buf = val, .len = 1 },
+                 .flags = I2C_M_RD, .buf = b1, .len = 1 },
         };

         if (i2c_transfer(priv->i2c, msg, 2) != 2) {
                 dev_warn(&priv->i2c->dev, "%s: i2c rd failed reg=%02x\n",
                                 KBUILD_MODNAME, reg);
+           kfree(b1);
                 return -EREMOTEIO;
         }
+       *val=b1[0];
+       kfree(b1);
         return 0;
  }

-- 
2.30.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-06 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 12:29 [PATCH] media: dvb: qt1010, change i2c read buffer from stack, to kernel space rkardell
2021-12-06 15:01 ` Mauro Carvalho Chehab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.