Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0828cf5 authored by Markus Elfring's avatar Markus Elfring Committed by Michael Ellerman
Browse files

powerpc: Use sizeof(*foo) rather than sizeof(struct foo)



It's slightly less error prone to use sizeof(*foo) rather than
specifying the type.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
[mpe: Consolidate into one patch, rewrite change log]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 31513207
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -207,8 +207,7 @@ int nvram_write_os_partition(struct nvram_os_partition *part,

	tmp_index = part->index;

	rc = ppc_md.nvram_write((char *)&info, sizeof(struct err_log_info),
				&tmp_index);
	rc = ppc_md.nvram_write((char *)&info, sizeof(info), &tmp_index);
	if (rc <= 0) {
		pr_err("%s: Failed nvram_write (%d)\n", __func__, rc);
		return rc;
@@ -244,9 +243,7 @@ int nvram_read_partition(struct nvram_os_partition *part, char *buff,
	tmp_index = part->index;

	if (part->os_partition) {
		rc = ppc_md.nvram_read((char *)&info,
					sizeof(struct err_log_info),
					&tmp_index);
		rc = ppc_md.nvram_read((char *)&info, sizeof(info), &tmp_index);
		if (rc <= 0) {
			pr_err("%s: Failed nvram_read (%d)\n", __func__, rc);
			return rc;
@@ -1173,7 +1170,7 @@ int __init nvram_scan_partitions(void)
			       "detected: 0-length partition\n");
			goto out;
		}
		tmp_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
		tmp_part = kmalloc(sizeof(*tmp_part), GFP_KERNEL);
		err = -ENOMEM;
		if (!tmp_part) {
			printk(KERN_ERR "nvram_scan_partitions: kmalloc failed\n");
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ prepare_cached_spu_info(struct spu *spu, unsigned long objectId)
	/* Create cached_info and set spu_info[spu->number] to point to it.
	 * spu->number is a system-wide value, not a per-node value.
	 */
	info = kzalloc(sizeof(struct cached_info), GFP_KERNEL);
	info = kzalloc(sizeof(*info), GFP_KERNEL);
	if (!info) {
		printk(KERN_ERR "SPU_PROF: "
		       "%s, line %d: create vma_map failed\n",
+2 −2
Original line number Diff line number Diff line
@@ -69,8 +69,8 @@ vma_map_add(struct vma_to_fileoffset_map *map, unsigned int vma,
	    unsigned int size, unsigned int offset, unsigned int guard_ptr,
	    unsigned int guard_val)
{
	struct vma_to_fileoffset_map *new =
		kzalloc(sizeof(struct vma_to_fileoffset_map), GFP_KERNEL);
	struct vma_to_fileoffset_map *new = kzalloc(sizeof(*new), GFP_KERNEL);

	if (!new) {
		printk(KERN_ERR "SPU_PROF: %s, line %d: malloc failed\n",
		       __func__, __LINE__);
+1 −1
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ static int ppc4xx_msi_probe(struct platform_device *dev)

	dev_dbg(&dev->dev, "PCIE-MSI: Setting up MSI support...\n");

	msi = kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL);
	msi = kzalloc(sizeof(*msi), GFP_KERNEL);
	if (!msi) {
		dev_err(&dev->dev, "No memory for MSI structure\n");
		return -ENOMEM;
+1 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ void *ppc4xx_ocm_alloc(phys_addr_t *phys, int size, int align,
		if (IS_ERR_VALUE(offset))
			continue;

		ocm_blk = kzalloc(sizeof(struct ocm_block), GFP_KERNEL);
		ocm_blk = kzalloc(sizeof(*ocm_blk), GFP_KERNEL);
		if (!ocm_blk) {
			printk(KERN_ERR "PPC4XX OCM: could not allocate ocm block");
			rh_free(ocm_reg->rh, offset);
Loading