From c9d4bc289cd1cd43c3cff97b73efe2b0b5098a92 Mon Sep 17 00:00:00 2001 From: Zhaolei Date: Tue, 14 Jul 2009 17:59:05 +0800 Subject: z2ram: Small cleanup for z2ram.c We should use Z2MINOR_COUNT as range argument in blk_unregister_region() Signed-off-by: Zhao Lei Signed-off-by: Tejun Heo --- drivers/block/z2ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index 4575171e5be..b2590409f25 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c @@ -374,7 +374,7 @@ err: static void __exit z2_exit(void) { int i, j; - blk_unregister_region(MKDEV(Z2RAM_MAJOR, 0), 256); + blk_unregister_region(MKDEV(Z2RAM_MAJOR, 0), Z2MINOR_COUNT); unregister_blkdev(Z2RAM_MAJOR, DEVICE_NAME); del_gendisk(z2ram_gendisk); put_disk(z2ram_gendisk); -- cgit v1.2.3 From 8f47428704c2fd6f787a6f340071b9c338b65803 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Mon, 13 Jul 2009 22:43:41 +0200 Subject: ataflop: adjust NULL test dtp is derefenced on the lines above the test !dtp, and so it cannot be NULL at this point. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r@ expression x,E,E1; identifier f,l; position p1,p2; @@ *x@p1->f = E1; ... when != x = E when != goto l; ( *x@p2 == NULL | *x@p2 != NULL ) // Signed-off-by: Julia Lawall Signed-off-by: Tejun Heo --- drivers/block/ataflop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index f5e7180d7f4..3ff02941b3d 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c @@ -1627,7 +1627,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, drive, dtp->blocks, dtp->spt, dtp->stretch); /* sanity check */ - if (!dtp || setprm.track != dtp->blocks/dtp->spt/2 || + if (setprm.track != dtp->blocks/dtp->spt/2 || setprm.head != 2) { redo_fd_request(); return -EINVAL; -- cgit v1.2.3 From 4fbfff76079a5c0e1751b0ddf53160d33f7831e7 Mon Sep 17 00:00:00 2001 From: Rakib Mullick Date: Fri, 17 Jul 2009 20:13:22 +0600 Subject: virtio_blk: mark virtio_blk with __refdata to kill spurious section mismatch The variable virtio_blk references the function virtblk_probe() (which is in .devinit section) and also references the function virtblk_remove() ( which is in .devexit section). So, virtio_blk simultaneously refers .devinit and .devexit section. To avoid this messup, we mark virtio_blk as __refdata. We were warned by the following warning: LD drivers/block/built-in.o WARNING: drivers/block/built-in.o(.data+0xc8dc): Section mismatch in reference from the variable virtio_blk to the function .devinit.text:virtblk_probe() The variable virtio_blk references the function __devinit virtblk_probe() If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console, WARNING: drivers/block/built-in.o(.data+0xc8e0): Section mismatch in reference from the variable virtio_blk to the function .devexit.text:virtblk_remove() The variable virtio_blk references the function __devexit virtblk_remove() If the reference is valid then annotate the variable with __exit* (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console, Signed-off-by: Rakib Mullick Signed-off-by: Tejun Heo --- drivers/block/virtio_blk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 43db3ea15b5..024f2d29258 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -424,7 +424,12 @@ static unsigned int features[] = { VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_IDENTIFY }; -static struct virtio_driver virtio_blk = { +/* + * virtio_blk causes spurious section mismatch warning by + * simultaneously referring to a __devinit and a __devexit function. + * Use __refdata to avoid this warning. + */ +static struct virtio_driver __refdata virtio_blk = { .feature_table = features, .feature_table_size = ARRAY_SIZE(features), .driver.name = KBUILD_MODNAME, -- cgit v1.2.3