diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-10-13 08:35:57 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-11-18 13:34:39 +0100 |
commit | 0bebaa5f01bc018cd0246997d2b00f1ed44964a8 (patch) | |
tree | dff4ae4d603974a257f5a18bd73aa2e4cdf66a90 /drivers/media/rc/redrat3.c | |
parent | [media] tveeprom: print log messages using pr_foo() (diff) | |
download | linux-0bebaa5f01bc018cd0246997d2b00f1ed44964a8.tar.xz linux-0bebaa5f01bc018cd0246997d2b00f1ed44964a8.zip |
[media] RedRat3: Use kcalloc() in two functions
* Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of data types by pointer dereferences
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/redrat3.c')
-rw-r--r-- | drivers/media/rc/redrat3.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 3b0ed1c3f2d8..67f35200b9eb 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -588,7 +588,7 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) int rc = 0; char *buffer; - buffer = kzalloc(sizeof(char) * (RR3_FW_VERSION_LEN + 1), GFP_KERNEL); + buffer = kcalloc(RR3_FW_VERSION_LEN + 1, sizeof(*buffer), GFP_KERNEL); if (!buffer) { dev_err(rr3->dev, "Memory allocation failure\n"); return; @@ -780,7 +780,9 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, /* rr3 will disable rc detector on transmit */ rr3->transmitting = true; - sample_lens = kzalloc(sizeof(int) * RR3_DRIVER_MAXLENS, GFP_KERNEL); + sample_lens = kcalloc(RR3_DRIVER_MAXLENS, + sizeof(*sample_lens), + GFP_KERNEL); if (!sample_lens) { ret = -ENOMEM; goto out; |