mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: rkardell <rkardell@mida.se>
To: linux-media@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, linux-kernel@vger.kernel.org
Subject: [PATCH] media: dvb: qt1010, change i2c read buffer from stack, to kernel space
Date: Thu, 7 Oct 2021 14:29:00 +0200	[thread overview]
Message-ID: <ccc99e48-de4f-045e-0fe4-61e3118e3f74@mida.se> (raw)

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



             reply	other threads:[~2021-10-07 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 12:29 rkardell [this message]
2021-12-06 15:01 ` Mauro Carvalho Chehab

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=ccc99e48-de4f-045e-0fe4-61e3118e3f74@mida.se \
    --to=rkardell@mida.se \
    --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®