Skip to contentSkip to conversation

media: dvb: mt352, change i2c read buffer from stack, to kernel space

PATCH In review rkardell 2 participants 3 messages Oct 7, 2021 – Nov 19, 2021 Media (V4L/DVB)

lore
Share & tools
lore

rkardell

author
#0 lore raw

PATCH 1/1 media: dvb: mt352, change i2c read buffer from stack, to kernel space

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

---
 drivers/media/dvb-frontends/mt352.c | 9 ++++++---

 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/mt352.c +0 -0
index 399d5c519..d7f33558d 100644
@@ -69,7 +69,7 @@ static int mt352_read_register(struct mt352_state* state, u8 reg)

 {
        int ret;
        u8 b0 [] = { reg };
-       u8 b1 [] = { 0 };
+    u8 *b1=kmalloc(1,GFP_KERNEL);
        struct i2c_msg msg [] = { { .addr = state->config.demod_address, .flags = 0,
                                    .buf = b0, .len = 1 },
@@ -82,12 +82,15 @@ static int mt352_read_register(struct mt352_state* state, u8 reg) if (ret != 2) {
                printk("%s: readreg error (reg=%d, ret==%i)\n", __func__, reg, ret);
+               kfree(b1);
                return ret;
        }
-
-       return b1[0];
+    ret=b1[0];
+    kfree(b1);
+       return ret;
 }

+
 static int mt352_sleep(struct dvb_frontend* fe)
 {
        static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };

Signature · 1 line
2.30.2
#1 lore raw

Em Thu, 7 Oct 2021 13:44:06 +0200
rkardell <[email protected]> escreveu:

Quoted 2 lines

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

This patch is full of 0xa0 characters instead of spaces, causing it to be rejected. Probably either your e-mailer of your text editor is doing something wrong. Please fix and resend.

Thanks!
Mauro

Quoted 41 lines
---
  drivers/media/dvb-frontends/mt352.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/mt352.c +1 -1
index 399d5c519..d7f33558d 100644
@@ -69,7 +69,7 @@ static int mt352_read_register(struct mt352_state* 
 state, u8 reg)
  {
         int ret;
         u8 b0 [] = { reg };
-       u8 b1 [] = { 0 };
+    u8 *b1=kmalloc(1,GFP_KERNEL);
         struct i2c_msg msg [] = { { .addr = state->config.demod_address,
                                     .flags = 0,

                                    .buf = b0, .len = 1 },

drivers/media/dvb-frontends/mt352.c +5 -2
@@ -82,12 +82,15 @@ static int mt352_read_register(struct mt352_state* 
 state, u8 reg)
         if (ret != 2) {
                 printk("%s: readreg error (reg=%d, ret==%i)\n",
                        __func__, reg, ret);
+               kfree(b1);
                 return ret;
         }
-
-       return b1[0];
+    ret=b1[0];
+    kfree(b1);
+       return ret;
  }
 
+
  static int mt352_sleep(struct dvb_frontend* fe)
  {

        static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };

#2 lore raw

Em Fri, 19 Nov 2021 16:16:12 +0000
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 6 lines

Em Thu, 7 Oct 2021 13:44:06 +0200
rkardell <[email protected]> escreveu:

Quoted 2 lines

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

Quoted 10 lines

This patch is full of 0xa0 characters instead of spaces, causing it to be rejected. Probably either your e-mailer of your text editor is doing something wrong. Please fix and resend.

Thanks!
Mauro

Quoted 3 lines

Ah, the SoB and the "From:" should use your real name.

Regards,
Mauro

Quoted 38 lines
Quoted 38 lines
---
  drivers/media/dvb-frontends/mt352.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/mt352.c +1 -1
index 399d5c519..d7f33558d 100644
@@ -69,7 +69,7 @@ static int mt352_read_register(struct mt352_state* 
 state, u8 reg)
  {
         int ret;
         u8 b0 [] = { reg };
-       u8 b1 [] = { 0 };
+    u8 *b1=kmalloc(1,GFP_KERNEL);
         struct i2c_msg msg [] = { { .addr = state->config.demod_address,
                                     .flags = 0,

                                    .buf = b0, .len = 1 },

drivers/media/dvb-frontends/mt352.c +5 -2
@@ -82,12 +82,15 @@ static int mt352_read_register(struct mt352_state* 
 state, u8 reg)
         if (ret != 2) {
                 printk("%s: readreg error (reg=%d, ret==%i)\n",
                        __func__, reg, ret);
+               kfree(b1);
                 return ret;
         }
-
-       return b1[0];
+    ret=b1[0];
+    kfree(b1);
+       return ret;
  }
 
+
  static int mt352_sleep(struct dvb_frontend* fe)
  {

        static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };