2013-05-14 05:45:39

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 0/4] media: remove duplicate check for EPERM

From: Lad, Prabhakar <[email protected]>

This patch series cleanups the check for EPERM in dbg_g/s_register
and vidioc_g/s_register.

Lad, Prabhakar (4):
media: i2c: remove duplicate checks for EPERM in dbg_g/s_register
media: dvb-frontends: remove duplicate checks for EPERM in
dbg_g/s_register
media: usb: remove duplicate checks for EPERM in vidioc_g/s_register
media: pci: remove duplicate checks for EPERM

drivers/media/dvb-frontends/au8522_decoder.c | 4 ----
drivers/media/i2c/ad9389b.c | 4 ----
drivers/media/i2c/adv7183.c | 4 ----
drivers/media/i2c/adv7604.c | 4 ----
drivers/media/i2c/cs5345.c | 4 ----
drivers/media/i2c/cx25840/cx25840-core.c | 4 ----
drivers/media/i2c/m52790.c | 4 ----
drivers/media/i2c/mt9v011.c | 4 ----
drivers/media/i2c/ov7670.c | 4 ----
drivers/media/i2c/saa7115.c | 4 ----
drivers/media/i2c/saa7127.c | 4 ----
drivers/media/i2c/saa717x.c | 4 ----
drivers/media/i2c/ths7303.c | 4 ----
drivers/media/i2c/tvp5150.c | 4 ----
drivers/media/i2c/tvp7002.c | 10 ++--------
drivers/media/i2c/upd64031a.c | 4 ----
drivers/media/i2c/upd64083.c | 4 ----
drivers/media/i2c/vs6624.c | 4 ----
drivers/media/pci/bt8xx/bttv-driver.c | 6 ------
drivers/media/pci/cx18/cx18-av-core.c | 4 ----
drivers/media/pci/cx23885/cx23885-ioctl.c | 6 ------
drivers/media/pci/cx23885/cx23888-ir.c | 4 ----
drivers/media/pci/ivtv/ivtv-ioctl.c | 2 --
drivers/media/pci/saa7146/mxb.c | 4 ----
drivers/media/pci/saa7164/saa7164-encoder.c | 6 ------
drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 --
26 files changed, 2 insertions(+), 110 deletions(-)

--
1.7.4.1


2013-05-14 05:46:31

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 1/4] media: i2c: remove duplicate checks for EPERM in dbg_g/s_register

From: Lad, Prabhakar <[email protected]>

This patch removes check for EPERM in dbg_g/s_register of subdevice
drivers as this check is already performed by core.

Signed-off-by: Lad, Prabhakar <[email protected]>
---
drivers/media/i2c/ad9389b.c | 4 ----
drivers/media/i2c/adv7183.c | 4 ----
drivers/media/i2c/adv7604.c | 4 ----
drivers/media/i2c/cs5345.c | 4 ----
drivers/media/i2c/cx25840/cx25840-core.c | 4 ----
drivers/media/i2c/m52790.c | 4 ----
drivers/media/i2c/mt9v011.c | 4 ----
drivers/media/i2c/ov7670.c | 4 ----
drivers/media/i2c/saa7115.c | 4 ----
drivers/media/i2c/saa7127.c | 4 ----
drivers/media/i2c/saa717x.c | 4 ----
drivers/media/i2c/ths7303.c | 4 ----
drivers/media/i2c/tvp5150.c | 4 ----
drivers/media/i2c/tvp7002.c | 10 ++--------
drivers/media/i2c/upd64031a.c | 4 ----
drivers/media/i2c/upd64083.c | 4 ----
drivers/media/i2c/vs6624.c | 4 ----
17 files changed, 2 insertions(+), 72 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index 58344b6..bd77895 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -347,8 +347,6 @@ static int ad9389b_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = ad9389b_rd(sd, reg->reg & 0xff);
reg->size = 1;
return 0;
@@ -360,8 +358,6 @@ static int ad9389b_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
ad9389b_wr(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
index 56a1fa4..fa7bb46 100644
--- a/drivers/media/i2c/adv7183.c
+++ b/drivers/media/i2c/adv7183.c
@@ -500,8 +500,6 @@ static int adv7183_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = adv7183_read(sd, reg->reg & 0xff);
reg->size = 1;
return 0;
@@ -513,8 +511,6 @@ static int adv7183_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
adv7183_write(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 31a63c9..e29e7c8 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -647,8 +647,6 @@ static int adv7604_g_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->size = 1;
switch (reg->reg >> 8) {
case 0:
@@ -705,8 +703,6 @@ static int adv7604_s_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
switch (reg->reg >> 8) {
case 0:
io_write(sd, reg->reg & 0xff, reg->val & 0xff);
diff --git a/drivers/media/i2c/cs5345.c b/drivers/media/i2c/cs5345.c
index 1d2f7c8..d27d9b7 100644
--- a/drivers/media/i2c/cs5345.c
+++ b/drivers/media/i2c/cs5345.c
@@ -103,8 +103,6 @@ static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->size = 1;
reg->val = cs5345_read(sd, reg->reg & 0x1f);
return 0;
@@ -116,8 +114,6 @@ static int cs5345_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
cs5345_write(sd, reg->reg & 0x1f, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 12fb9b2..33c4e51 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -1664,8 +1664,6 @@ static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->size = 1;
reg->val = cx25840_read(client, reg->reg & 0x0fff);
return 0;
@@ -1677,8 +1675,6 @@ static int cx25840_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
cx25840_write(client, reg->reg & 0x0fff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/m52790.c b/drivers/media/i2c/m52790.c
index 39f50fd..7b46a2f 100644
--- a/drivers/media/i2c/m52790.c
+++ b/drivers/media/i2c/m52790.c
@@ -87,8 +87,6 @@ static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
if (reg->reg != 0)
return -EINVAL;
reg->size = 1;
@@ -103,8 +101,6 @@ static int m52790_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
if (reg->reg != 0)
return -EINVAL;
state->input = reg->val & 0x0303;
diff --git a/drivers/media/i2c/mt9v011.c b/drivers/media/i2c/mt9v011.c
index 3f415fd..0d53f14 100644
--- a/drivers/media/i2c/mt9v011.c
+++ b/drivers/media/i2c/mt9v011.c
@@ -411,8 +411,6 @@ static int mt9v011_g_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;

reg->val = mt9v011_read(sd, reg->reg & 0xff);
reg->size = 2;
@@ -427,8 +425,6 @@ static int mt9v011_s_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;

mt9v011_write(sd, reg->reg & 0xff, reg->val & 0xffff);

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 617ad3f..eb043eb 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -1479,8 +1479,6 @@ static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
ret = ov7670_read(sd, reg->reg & 0xff, &val);
reg->val = val;
reg->size = 1;
@@ -1493,8 +1491,6 @@ static int ov7670_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
ov7670_write(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index d6f589a..d36994d 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1464,8 +1464,6 @@ static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = saa711x_read(sd, reg->reg & 0xff);
reg->size = 1;
return 0;
@@ -1477,8 +1475,6 @@ static int saa711x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
saa711x_write(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/saa7127.c b/drivers/media/i2c/saa7127.c
index 8a47ac1..40ca361 100644
--- a/drivers/media/i2c/saa7127.c
+++ b/drivers/media/i2c/saa7127.c
@@ -665,8 +665,6 @@ static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = saa7127_read(sd, reg->reg & 0xff);
reg->size = 1;
return 0;
@@ -678,8 +676,6 @@ static int saa7127_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
saa7127_write(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c
index cf3a0aa..b38c5fd 100644
--- a/drivers/media/i2c/saa717x.c
+++ b/drivers/media/i2c/saa717x.c
@@ -981,8 +981,6 @@ static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = saa717x_read(sd, reg->reg);
reg->size = 1;
return 0;
@@ -996,8 +994,6 @@ static int saa717x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
saa717x_write(sd, addr, val);
return 0;
}
diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index c433955..65853ee 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -236,8 +236,6 @@ static int ths7303_g_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;

reg->size = 1;
reg->val = ths7303_read(sd, reg->reg);
@@ -251,8 +249,6 @@ static int ths7303_s_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;

ths7303_write(sd, reg->reg, reg->val);
return 0;
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 485159a..f6ecd29 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1054,8 +1054,6 @@ static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
res = tvp5150_read(sd, reg->reg & 0xff);
if (res < 0) {
v4l2_err(sd, "%s: failed with error = %d\n", __func__, res);
@@ -1073,8 +1071,6 @@ static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 270e699..f2d908f 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -739,8 +739,7 @@ static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
*
* Get the value of a TVP7002 decoder device register.
* Returns zero when successful, -EINVAL if register read fails or
- * access to I2C client fails, -EPERM if the call is not allowed
- * by disabled CAP_SYS_ADMIN.
+ * access to I2C client fails.
*/
static int tvp7002_g_register(struct v4l2_subdev *sd,
struct v4l2_dbg_register *reg)
@@ -751,8 +750,6 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;

ret = tvp7002_read(sd, reg->reg & 0xff, &val);
reg->val = val;
@@ -765,8 +762,7 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,
* @reg: ptr to v4l2_dbg_register struct
*
* Get the value of a TVP7002 decoder device register.
- * Returns zero when successful, -EINVAL if register read fails or
- * -EPERM if call not allowed.
+ * Returns zero when successful, -EINVAL if register read fails.
*/
static int tvp7002_s_register(struct v4l2_subdev *sd,
const struct v4l2_dbg_register *reg)
@@ -775,8 +771,6 @@ static int tvp7002_s_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;

return tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff);
}
diff --git a/drivers/media/i2c/upd64031a.c b/drivers/media/i2c/upd64031a.c
index f0a0921..2055128 100644
--- a/drivers/media/i2c/upd64031a.c
+++ b/drivers/media/i2c/upd64031a.c
@@ -168,8 +168,6 @@ static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = upd64031a_read(sd, reg->reg & 0xff);
reg->size = 1;
return 0;
@@ -181,8 +179,6 @@ static int upd64031a_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_re

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
upd64031a_write(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/upd64083.c b/drivers/media/i2c/upd64083.c
index 343e021..2b802c1 100644
--- a/drivers/media/i2c/upd64083.c
+++ b/drivers/media/i2c/upd64083.c
@@ -126,8 +126,6 @@ static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = upd64083_read(sd, reg->reg & 0xff);
reg->size = 1;
return 0;
@@ -139,8 +137,6 @@ static int upd64083_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_reg

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
upd64083_write(sd, reg->reg & 0xff, reg->val & 0xff);
return 0;
}
diff --git a/drivers/media/i2c/vs6624.c b/drivers/media/i2c/vs6624.c
index f366fad..c154697 100644
--- a/drivers/media/i2c/vs6624.c
+++ b/drivers/media/i2c/vs6624.c
@@ -741,8 +741,6 @@ static int vs6624_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = vs6624_read(sd, reg->reg & 0xffff);
reg->size = 1;
return 0;
@@ -754,8 +752,6 @@ static int vs6624_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
vs6624_write(sd, reg->reg & 0xffff, reg->val & 0xff);
return 0;
}
--
1.7.4.1

2013-05-14 05:47:05

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 2/4] media: dvb-frontends: remove duplicate checks for EPERM in dbg_g/s_register

From: Lad, Prabhakar <[email protected]>

This patch removes check for EPERM in dbg_g/s_register
as this check is already performed by core.

Signed-off-by: Lad, Prabhakar <[email protected]>
---
drivers/media/dvb-frontends/au8522_decoder.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c
index 2099f21..9d159b4 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -529,8 +529,6 @@ static int au8522_g_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->val = au8522_readreg(state, reg->reg & 0xffff);
return 0;
}
@@ -543,8 +541,6 @@ static int au8522_s_register(struct v4l2_subdev *sd,

if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
au8522_writereg(state, reg->reg, reg->val & 0xff);
return 0;
}
--
1.7.4.1

2013-05-14 05:48:02

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 3/4] media: usb: remove duplicate checks for EPERM in vidioc_g/s_register

From: Lad, Prabhakar <[email protected]>

This patch removes check for EPERM in vidioc_g/s_register
as this check is already performed by core.

Signed-off-by: Lad, Prabhakar <[email protected]>
---
drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
index e11267f..01d1c2d 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
@@ -5173,8 +5173,6 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
int stat = 0;
int okFl = 0;

- if (!capable(CAP_SYS_ADMIN)) return -EPERM;
-
req.match = *match;
req.reg = reg_id;
if (setFl) req.val = *val_ptr;
--
1.7.4.1

2013-05-14 05:48:46

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 4/4] media: pci: remove duplicate checks for EPERM

From: Lad, Prabhakar <[email protected]>

This patch removes check for EPERM in dbg_g/s_register and
vidioc_g/s_register as this check is already performed by core.

Signed-off-by: Lad, Prabhakar <[email protected]>
---
drivers/media/pci/bt8xx/bttv-driver.c | 6 ------
drivers/media/pci/cx18/cx18-av-core.c | 4 ----
drivers/media/pci/cx23885/cx23885-ioctl.c | 6 ------
drivers/media/pci/cx23885/cx23888-ir.c | 4 ----
drivers/media/pci/ivtv/ivtv-ioctl.c | 2 --
drivers/media/pci/saa7146/mxb.c | 4 ----
drivers/media/pci/saa7164/saa7164-encoder.c | 6 ------
7 files changed, 0 insertions(+), 32 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index e7d0884..a334c94 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -1936,9 +1936,6 @@ static int bttv_g_register(struct file *file, void *f,
struct bttv_fh *fh = f;
struct bttv *btv = fh->btv;

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
if (!v4l2_chip_match_host(&reg->match)) {
/* TODO: subdev errors should not be ignored, this should become a
subdev helper function. */
@@ -1960,9 +1957,6 @@ static int bttv_s_register(struct file *file, void *f,
struct bttv_fh *fh = f;
struct bttv *btv = fh->btv;

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
if (!v4l2_chip_match_host(&reg->match)) {
/* TODO: subdev errors should not be ignored, this should become a
subdev helper function. */
diff --git a/drivers/media/pci/cx18/cx18-av-core.c b/drivers/media/pci/cx18/cx18-av-core.c
index 38b1d64..ba8caf0 100644
--- a/drivers/media/pci/cx18/cx18-av-core.c
+++ b/drivers/media/pci/cx18/cx18-av-core.c
@@ -1258,8 +1258,6 @@ static int cx18_av_g_register(struct v4l2_subdev *sd,
return -EINVAL;
if ((reg->reg & 0x3) != 0)
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->size = 4;
reg->val = cx18_av_read4(cx, reg->reg & 0x00000ffc);
return 0;
@@ -1274,8 +1272,6 @@ static int cx18_av_s_register(struct v4l2_subdev *sd,
return -EINVAL;
if ((reg->reg & 0x3) != 0)
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
cx18_av_write4(cx, reg->reg & 0x00000ffc, reg->val);
return 0;
}
diff --git a/drivers/media/pci/cx23885/cx23885-ioctl.c b/drivers/media/pci/cx23885/cx23885-ioctl.c
index acdb6d5..00f5125 100644
--- a/drivers/media/pci/cx23885/cx23885-ioctl.c
+++ b/drivers/media/pci/cx23885/cx23885-ioctl.c
@@ -138,9 +138,6 @@ int cx23885_g_register(struct file *file, void *fh,
{
struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
if (reg->match.type == V4L2_CHIP_MATCH_HOST) {
switch (reg->match.addr) {
case 0:
@@ -186,9 +183,6 @@ int cx23885_s_register(struct file *file, void *fh,
{
struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
if (reg->match.type == V4L2_CHIP_MATCH_HOST) {
switch (reg->match.addr) {
case 0:
diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c
index fa672fe..cd98651 100644
--- a/drivers/media/pci/cx23885/cx23888-ir.c
+++ b/drivers/media/pci/cx23885/cx23888-ir.c
@@ -1116,8 +1116,6 @@ static int cx23888_ir_g_register(struct v4l2_subdev *sd,
return -EINVAL;
if (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG)
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
reg->size = 4;
reg->val = cx23888_ir_read4(state->dev, addr);
return 0;
@@ -1135,8 +1133,6 @@ static int cx23888_ir_s_register(struct v4l2_subdev *sd,
return -EINVAL;
if (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG)
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
cx23888_ir_write4(state->dev, addr, reg->val);
return 0;
}
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 9cbbce0..3e281ec 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -715,8 +715,6 @@ static int ivtv_itvc(struct ivtv *itv, bool get, u64 reg, u64 *val)
{
volatile u8 __iomem *reg_start;

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
if (reg >= IVTV_REG_OFFSET && reg < IVTV_REG_OFFSET + IVTV_REG_SIZE)
reg_start = itv->reg_mem - IVTV_REG_OFFSET;
else if (itv->has_cx23415 && reg >= IVTV_DECODER_OFFSET &&
diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c
index 71e8bea..52cbe7a0 100644
--- a/drivers/media/pci/saa7146/mxb.c
+++ b/drivers/media/pci/saa7146/mxb.c
@@ -669,8 +669,6 @@ static int vidioc_g_register(struct file *file, void *fh, struct v4l2_dbg_regist
{
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
if (v4l2_chip_match_host(&reg->match)) {
reg->val = saa7146_read(dev, reg->reg);
reg->size = 4;
@@ -684,8 +682,6 @@ static int vidioc_s_register(struct file *file, void *fh, const struct v4l2_dbg_
{
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
if (v4l2_chip_match_host(&reg->match)) {
saa7146_write(dev, reg->reg, reg->val);
return 0;
diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c
index 0b74fb2..63a72fb 100644
--- a/drivers/media/pci/saa7164/saa7164-encoder.c
+++ b/drivers/media/pci/saa7164/saa7164-encoder.c
@@ -1306,9 +1306,6 @@ static int saa7164_g_register(struct file *file, void *fh,
struct saa7164_dev *dev = port->dev;
dprintk(DBGLVL_ENC, "%s()\n", __func__);

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
return 0;
}

@@ -1319,9 +1316,6 @@ static int saa7164_s_register(struct file *file, void *fh,
struct saa7164_dev *dev = port->dev;
dprintk(DBGLVL_ENC, "%s()\n", __func__);

- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
-
return 0;
}
#endif
--
1.7.4.1

2013-05-22 05:52:27

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH 0/4] media: remove duplicate check for EPERM

Hi All,

On Tue, May 14, 2013 at 11:15 AM, Lad Prabhakar
<[email protected]> wrote:
> From: Lad, Prabhakar <[email protected]>
>
> This patch series cleanups the check for EPERM in dbg_g/s_register
> and vidioc_g/s_register.
>
> Lad, Prabhakar (4):
> media: i2c: remove duplicate checks for EPERM in dbg_g/s_register
> media: dvb-frontends: remove duplicate checks for EPERM in
> dbg_g/s_register
> media: usb: remove duplicate checks for EPERM in vidioc_g/s_register
> media: pci: remove duplicate checks for EPERM
>
Gentle ping..

Regards,
--Prabhakar Lad

2013-05-22 06:49:16

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 0/4] media: remove duplicate check for EPERM

On Wed May 22 2013 07:52:03 Prabhakar Lad wrote:
> Hi All,
>
> On Tue, May 14, 2013 at 11:15 AM, Lad Prabhakar
> <[email protected]> wrote:
> > From: Lad, Prabhakar <[email protected]>
> >
> > This patch series cleanups the check for EPERM in dbg_g/s_register
> > and vidioc_g/s_register.
> >
> > Lad, Prabhakar (4):
> > media: i2c: remove duplicate checks for EPERM in dbg_g/s_register
> > media: dvb-frontends: remove duplicate checks for EPERM in
> > dbg_g/s_register
> > media: usb: remove duplicate checks for EPERM in vidioc_g/s_register
> > media: pci: remove duplicate checks for EPERM
> >
> Gentle ping..

For the record: it's in my queue and I plan on merging this on Friday.

Regards,

Hans