public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: roel <12o3l@tiscali.nl>
To: Konrad Rzeszutek <konrad@darnok.org>
Cc: linux-kernel@vger.kernel.org, pjones@redhat.com,
	konradr@redhat.com, konradr@linux.vnet.ibm.com
Subject: Re: [PATCH] Add iSCSI iBFT support.
Date: Wed, 26 Sep 2007 21:37:03 +0200	[thread overview]
Message-ID: <46FAB4DF.4040901@tiscali.nl> (raw)
In-Reply-To: <20070926184652.GA16369@andromeda.dapyr.net>

Konrad Rzeszutek wrote:

[...]

> +static ssize_t
> +ibft_read_binary(struct kobject *kobj, struct bin_attribute *attr, char *buf,
> +		 loff_t off, size_t count)
> +{
> +
> +	struct ibft_device *ibft = container_of(kobj, struct ibft_device, kobj);
> +	ssize_t len = ibft->hdr->length;
> +
> +	if (off > len)
> +		return 0;
> +
> +	if (off + count > len)
> +		count = len - off;

maybe you want to use:

count = min(count, len - off)

> +
> +	memcpy(buf, ibft->hdr + off, count);
> +
> +	return count;
> +}

[...]

> +static struct ibft_device *ibft_idev;
> +/*
> + * ibft_init() - creates  sysfs tree entry for ibft data
> + */
> +static int __init ibft_init(void)
> +{
> +	int rc = 0;
> +
> +	printk(KERN_INFO "BIOS iBFT facility v%s %s\n", ISCSI_IBFT_VERSION,
> +	       ISCSI_IBFT_DATE);
> +
> +	if (!ibft_phys)
> +		find_ibft();
> +
> +	/* What if the ibft_subsys is underneath another struct? */
> +	rc = firmware_register(&ibft_subsys);
> +	if (rc)
> +		return rc;
> +
> +	if (ibft_phys) {
> +		printk(KERN_INFO "iBFT detected at 0x%lx.\n",
> +		       (unsigned long)ibft_phys);
> +		ibft_idev = kzalloc(sizeof(*ibft_idev), GFP_KERNEL);
> +		if (!ibft_idev)
> +			return -ENOMEM;
> +
> +		rc = ibft_device_register(ibft_idev);
> +		if (rc) {
> +			kfree(ibft_idev);
> +			return rc;
> +		}

you could do without this return statement (and the brackets) since rc is returned anyway...

> +	} else {
> +		printk(KERN_INFO "No iBFT detected.\n");
> +	}

these brackets are not required either

> +	return rc;

... here

> +}

[...]

Roel

  reply	other threads:[~2007-09-26 19:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26 18:46 [PATCH] Add iSCSI iBFT support Konrad Rzeszutek
2007-09-26 19:37 ` roel [this message]
2007-09-26 21:10 ` Greg KH
2007-09-27  0:08   ` Konrad Rzeszutek
2007-09-27  2:04     ` Greg KH
2007-09-26 21:13 ` Randy Dunlap
2007-09-27  0:16   ` Konrad Rzeszutek
2007-09-26 21:29 ` Randy Dunlap
2007-09-27  0:52   ` Konrad Rzeszutek
     [not found]     ` <14e4363b0709261817t5f0b1922m99c24549ce316de8@mail.gmail.com>
2007-09-27  4:00       ` Randy Dunlap
2007-09-27  4:29     ` Randy Dunlap
2007-09-27 17:06     ` H. Peter Anvin
2007-09-27 17:12       ` Peter Jones
2007-09-27 17:18         ` H. Peter Anvin
2007-09-27 17:51           ` Peter Jones
2007-09-27 20:50             ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46FAB4DF.4040901@tiscali.nl \
    --to=12o3l@tiscali.nl \
    --cc=konrad@darnok.org \
    --cc=konradr@linux.vnet.ibm.com \
    --cc=konradr@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox