Re: [PATCH v10] block: Add n64 cart driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static int n64cart_do_bvec(struct device *dev, struct bio_vec *bv,
> +			   unsigned int len, unsigned int off,
> +			   u32 pos)

I think this should either return bool or a blk_status_t instead
of the int with 1/0 values.

> +	if (bio_end_sector(bio) > get_capacity(bio->bi_disk))
> +		goto io_error;

This check is already performed by the block layer.  I have a series
pending that removes it from the few drivers that duplicate it.

> +
> +	bio_for_each_segment(bvec, bio, iter) {
> +		unsigned int len = bvec.bv_len;
> +		int err;
> +
> +		/* Alignment check */
> +		WARN_ON_ONCE((bvec.bv_offset & (MIN_ALIGNMENT - 1)) ||
> +				(len & (MIN_ALIGNMENT - 1)));
> +
> +		err = n64cart_do_bvec(dev, &bvec, len,
> +				      bvec.bv_offset, pos);
> +		if (err)
> +			goto io_error;
> +		pos += len;

Nit: I'd just pass the bvec to n64cart_do_bvec, calculate pos there
locally each time, and also move the WARN_ON_ONCE into the helper.

No real need for the len local variable either.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux