[PATCH 3/8] [media] cx231xx: Improve six size determinations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 17 Sep 2017 18:38:50 +0200

Replace the specification of data structures by variable references
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/media/usb/cx231xx/cx231xx-dvb.c   | 10 +++++-----
 drivers/media/usb/cx231xx/cx231xx-video.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 0813f368fb3c..35d98ec948b2 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -611,5 +611,5 @@ static int dvb_init(struct cx231xx *dev)
 		return 0;
 	}
 
-	dvb = kzalloc(sizeof(struct cx231xx_dvb), GFP_KERNEL);
+	dvb = kzalloc(sizeof(*dvb), GFP_KERNEL);
 	if (!dvb)
@@ -754,7 +754,7 @@ static int dvb_init(struct cx231xx *dev)
 		si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL,
 		si2165_pdata.ref_freq_Hz = 16000000,
 
-		memset(&info, 0, sizeof(struct i2c_board_info));
+		memset(&info, 0, sizeof(info));
 		strlcpy(info.type, "si2165", I2C_NAME_SIZE);
 		info.addr = 0x64;
 		info.platform_data = &si2165_pdata;
@@ -801,7 +801,7 @@ static int dvb_init(struct cx231xx *dev)
 		si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT,
 		si2165_pdata.ref_freq_Hz = 24000000,
 
-		memset(&info, 0, sizeof(struct i2c_board_info));
+		memset(&info, 0, sizeof(info));
 		strlcpy(info.type, "si2165", I2C_NAME_SIZE);
 		info.addr = 0x64;
 		info.platform_data = &si2165_pdata;
@@ -822,7 +822,7 @@ static int dvb_init(struct cx231xx *dev)
 
 		dvb->i2c_client_demod = client;
 
-		memset(&info, 0, sizeof(struct i2c_board_info));
+		memset(&info, 0, sizeof(info));
 
 		dev->dvb->frontend->ops.i2c_gate_ctrl = NULL;
 
@@ -869,7 +869,7 @@ static int dvb_init(struct cx231xx *dev)
 		struct i2c_board_info info;
 		struct si2157_config si2157_config;
 
-		memset(&info, 0, sizeof(struct i2c_board_info));
+		memset(&info, 0, sizeof(info));
 
 		dev->dvb->frontend = dvb_attach(lgdt3306a_attach,
 			&hauppauge_955q_lgdt3306a_config,
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index 956f8cbcb454..a12ec3567684 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1771,5 +1771,5 @@ static int cx231xx_v4l2_open(struct file *filp)
 	}
 #endif
 
-	fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL);
+	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
 	if (!fh)
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux