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

Commit 041af0bb authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Roland Dreier
Browse files

IB/qib: Fix sizeof checkpatch warnings

parent 590c3fec
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ static struct qib_diag_client *get_client(struct qib_devdata *dd)
		client_pool = dc->next;
	else
		/* None in pool, alloc and init */
		dc = kmalloc(sizeof *dc, GFP_KERNEL);
		dc = kmalloc(sizeof(*dc), GFP_KERNEL);

	if (dc) {
		dc->next = NULL;
@@ -698,7 +698,7 @@ int qib_register_observer(struct qib_devdata *dd,

	if (!dd || !op)
		return -EINVAL;
	olp = vmalloc(sizeof *olp);
	olp = vmalloc(sizeof(*olp));
	if (!olp) {
		pr_err("vmalloc for observer failed\n");
		return -ENOMEM;
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ const char *qib_get_unit_name(int unit)
{
	static char iname[16];

	snprintf(iname, sizeof iname, "infinipath%u", unit);
	snprintf(iname, sizeof(iname), "infinipath%u", unit);
	return iname;
}

+6 −6
Original line number Diff line number Diff line
@@ -251,17 +251,17 @@ void qib_get_eeprom_info(struct qib_devdata *dd)
		 * This board has a Serial-prefix, which is stored
		 * elsewhere for backward-compatibility.
		 */
		memcpy(snp, ifp->if_sprefix, sizeof ifp->if_sprefix);
		snp[sizeof ifp->if_sprefix] = '\0';
		memcpy(snp, ifp->if_sprefix, sizeof(ifp->if_sprefix));
		snp[sizeof(ifp->if_sprefix)] = '\0';
		len = strlen(snp);
		snp += len;
		len = (sizeof dd->serial) - len;
		if (len > sizeof ifp->if_serial)
			len = sizeof ifp->if_serial;
		len = sizeof(dd->serial) - len;
		if (len > sizeof(ifp->if_serial))
			len = sizeof(ifp->if_serial);
		memcpy(snp, ifp->if_serial, len);
	} else
		memcpy(dd->serial, ifp->if_serial,
		       sizeof ifp->if_serial);
		       sizeof(ifp->if_serial));
	if (!strstr(ifp->if_comment, "Tested successfully"))
		qib_dev_err(dd,
			"Board SN %s did not pass functional test: %s\n",
+2 −2
Original line number Diff line number Diff line
@@ -437,7 +437,7 @@ static int qib_tid_update(struct qib_ctxtdata *rcd, struct file *fp,
			goto cleanup;
		}
		if (copy_to_user((void __user *) (unsigned long) ti->tidmap,
				 tidmap, sizeof tidmap)) {
				 tidmap, sizeof(tidmap))) {
			ret = -EFAULT;
			goto cleanup;
		}
@@ -484,7 +484,7 @@ static int qib_tid_free(struct qib_ctxtdata *rcd, unsigned subctxt,
	}

	if (copy_from_user(tidmap, (void __user *)(unsigned long)ti->tidmap,
			   sizeof tidmap)) {
			   sizeof(tidmap))) {
		ret = -EFAULT;
		goto done;
	}
+4 −4
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ static ssize_t driver_stats_read(struct file *file, char __user *buf,
{
	qib_stats.sps_ints = qib_sps_ints();
	return simple_read_from_buffer(buf, count, ppos, &qib_stats,
				       sizeof qib_stats);
				       sizeof(qib_stats));
}

/*
@@ -133,7 +133,7 @@ static ssize_t driver_names_read(struct file *file, char __user *buf,
				 size_t count, loff_t *ppos)
{
	return simple_read_from_buffer(buf, count, ppos, qib_statnames,
		sizeof qib_statnames - 1); /* no null */
		sizeof(qib_statnames) - 1); /* no null */
}

static const struct file_operations driver_ops[] = {
@@ -379,7 +379,7 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
	int ret, i;

	/* create the per-unit directory */
	snprintf(unit, sizeof unit, "%u", dd->unit);
	snprintf(unit, sizeof(unit), "%u", dd->unit);
	ret = create_file(unit, S_IFDIR|S_IRUGO|S_IXUGO, sb->s_root, &dir,
			  &simple_dir_operations, dd);
	if (ret) {
@@ -482,7 +482,7 @@ static int remove_device_files(struct super_block *sb,

	root = dget(sb->s_root);
	mutex_lock(&root->d_inode->i_mutex);
	snprintf(unit, sizeof unit, "%u", dd->unit);
	snprintf(unit, sizeof(unit), "%u", dd->unit);
	dir = lookup_one_len(unit, root, strlen(unit));

	if (IS_ERR(dir)) {
Loading