summaryrefslogtreecommitdiff
path: root/drivers/dpll
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-20 23:49:23 -0800
committerKees Cook <kees@kernel.org>2026-02-21 01:02:28 -0800
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/dpll
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
downloadlinux-next-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.gz
linux-next-69050f8d6d075dc01af7a5f2f550a8067510366f.zip
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/dpll')
-rw-r--r--drivers/dpll/dpll_core.c14
-rw-r--r--drivers/dpll/zl3073x/dpll.c4
-rw-r--r--drivers/dpll/zl3073x/fw.c4
-rw-r--r--drivers/dpll/zl3073x/prop.c4
4 files changed, 13 insertions, 13 deletions
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 627a5b39a0ef..cd41fbedd9fe 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -205,7 +205,7 @@ dpll_xa_ref_pin_add(struct xarray *xa_pins, struct dpll_pin *pin,
}
if (!ref_exists) {
- ref = kzalloc(sizeof(*ref), GFP_KERNEL);
+ ref = kzalloc_obj(*ref, GFP_KERNEL);
if (!ref)
return -ENOMEM;
ref->pin = pin;
@@ -218,7 +218,7 @@ dpll_xa_ref_pin_add(struct xarray *xa_pins, struct dpll_pin *pin,
refcount_set(&ref->refcount, 1);
}
- reg = kzalloc(sizeof(*reg), GFP_KERNEL);
+ reg = kzalloc_obj(*reg, GFP_KERNEL);
if (!reg) {
if (!ref_exists) {
xa_erase(xa_pins, pin->pin_idx);
@@ -286,7 +286,7 @@ dpll_xa_ref_dpll_add(struct xarray *xa_dplls, struct dpll_device *dpll,
}
if (!ref_exists) {
- ref = kzalloc(sizeof(*ref), GFP_KERNEL);
+ ref = kzalloc_obj(*ref, GFP_KERNEL);
if (!ref)
return -ENOMEM;
ref->dpll = dpll;
@@ -299,7 +299,7 @@ dpll_xa_ref_dpll_add(struct xarray *xa_dplls, struct dpll_device *dpll,
refcount_set(&ref->refcount, 1);
}
- reg = kzalloc(sizeof(*reg), GFP_KERNEL);
+ reg = kzalloc_obj(*reg, GFP_KERNEL);
if (!reg) {
if (!ref_exists) {
xa_erase(xa_dplls, dpll->id);
@@ -360,7 +360,7 @@ dpll_device_alloc(const u64 clock_id, u32 device_idx, struct module *module)
struct dpll_device *dpll;
int ret;
- dpll = kzalloc(sizeof(*dpll), GFP_KERNEL);
+ dpll = kzalloc_obj(*dpll, GFP_KERNEL);
if (!dpll)
return ERR_PTR(-ENOMEM);
refcount_set(&dpll->refcount, 1);
@@ -490,7 +490,7 @@ int dpll_device_register(struct dpll_device *dpll, enum dpll_type type,
return -EEXIST;
}
- reg = kzalloc(sizeof(*reg), GFP_KERNEL);
+ reg = kzalloc_obj(*reg, GFP_KERNEL);
if (!reg) {
mutex_unlock(&dpll_lock);
return -ENOMEM;
@@ -644,7 +644,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,
} else if (pin_idx > INT_MAX) {
return ERR_PTR(-EINVAL);
}
- pin = kzalloc(sizeof(*pin), GFP_KERNEL);
+ pin = kzalloc_obj(*pin, GFP_KERNEL);
if (!pin) {
ret = -ENOMEM;
goto err_pin_alloc;
diff --git a/drivers/dpll/zl3073x/dpll.c b/drivers/dpll/zl3073x/dpll.c
index 78edc36b17fb..e532fedf0d36 100644
--- a/drivers/dpll/zl3073x/dpll.c
+++ b/drivers/dpll/zl3073x/dpll.c
@@ -1372,7 +1372,7 @@ zl3073x_dpll_pin_alloc(struct zl3073x_dpll *zldpll, enum dpll_pin_direction dir,
{
struct zl3073x_dpll_pin *pin;
- pin = kzalloc(sizeof(*pin), GFP_KERNEL);
+ pin = kzalloc_obj(*pin, GFP_KERNEL);
if (!pin)
return ERR_PTR(-ENOMEM);
@@ -1944,7 +1944,7 @@ zl3073x_dpll_alloc(struct zl3073x_dev *zldev, u8 ch)
{
struct zl3073x_dpll *zldpll;
- zldpll = kzalloc(sizeof(*zldpll), GFP_KERNEL);
+ zldpll = kzalloc_obj(*zldpll, GFP_KERNEL);
if (!zldpll)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/dpll/zl3073x/fw.c b/drivers/dpll/zl3073x/fw.c
index 55b638247f4b..56b4eeadf4e3 100644
--- a/drivers/dpll/zl3073x/fw.c
+++ b/drivers/dpll/zl3073x/fw.c
@@ -129,7 +129,7 @@ zl3073x_fw_component_alloc(size_t size)
{
struct zl3073x_fw_component *comp;
- comp = kzalloc(sizeof(*comp), GFP_KERNEL);
+ comp = kzalloc_obj(*comp, GFP_KERNEL);
if (!comp)
return NULL;
@@ -313,7 +313,7 @@ struct zl3073x_fw *zl3073x_fw_load(struct zl3073x_dev *zldev, const char *data,
ssize_t rc;
/* Allocate firmware structure */
- fw = kzalloc(sizeof(*fw), GFP_KERNEL);
+ fw = kzalloc_obj(*fw, GFP_KERNEL);
if (!fw)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/dpll/zl3073x/prop.c b/drivers/dpll/zl3073x/prop.c
index 8523dc8c226e..36b843f17156 100644
--- a/drivers/dpll/zl3073x/prop.c
+++ b/drivers/dpll/zl3073x/prop.c
@@ -198,7 +198,7 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct zl3073x_dev *zldev,
const char *type;
u32 curr_freq;
- props = kzalloc(sizeof(*props), GFP_KERNEL);
+ props = kzalloc_obj(*props, GFP_KERNEL);
if (!props)
return ERR_PTR(-ENOMEM);
@@ -289,7 +289,7 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct zl3073x_dev *zldev,
skip_fwnode_props:
/* Allocate frequency ranges list - extra slot for current frequency */
- ranges = kcalloc(num_freqs + 1, sizeof(*ranges), GFP_KERNEL);
+ ranges = kzalloc_objs(*ranges, num_freqs + 1, GFP_KERNEL);
if (!ranges) {
rc = -ENOMEM;
goto err_alloc_ranges;