Re: [PATCH] ibmvscsi driver - sixth version

James Bottomley
2004-03-31T21:59:16Z

On Wed, 2004-03-31 at 16:26, Dave Boutcher wrote:
> Comments always welcomed. I would like to get this upstream if I can,
> since the linux distributors are complaining slightly that it is not.

Actually, this:

+ (u64) (unsigned long)dma_map_single(dev, cmd->request_buffer,
+ cmd->request_bufflen,
+ DMA_BIDIRECTIONAL);
+ if (pci_dma_mapping_error(data->virtual_address)) {
+ printk(KERN_ERR
+ "ibmvscsi: Unable to map request_buffer for command!\n");
+ return 0;

Should be

if(dma_mapping_error())

I have no idea why there are two identical APIs for the mapping error,
but since you use the DMA API, you should use its version. You can also
drop the #include <linux/pci.h> as well.

This:

+ sg_mapped = dma_map_sg(dev, sg, cmd->use_sg, DMA_BIDIRECTIONAL);
+
+ if (pci_dma_mapping_error(sg_dma_address(&sg[0])))
+ return 0;

Is wrong. dma_map_sg returns zero if there's a mapping error, you
should check for that.

James