Re: [PATCH] floppy: reintroduce O_NDELAY fix

kernel test robot
2021-01-21T13:34:41Z

[-- Attachment #1: Type: text/plain, Size: 6802 bytes --]

Hi Jiri,

I love your patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[also build test ERROR on linux/master linus/master v5.11-rc4 next-20210121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Jiri-Kosina/floppy-reintroduce-O_NDELAY-fix/20210121-182951
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: sparc64-randconfig-r033-20210121 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/605da67173ab7c362845b2f74c2914bfcec6db2e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jiri-Kosina/floppy-reintroduce-O_NDELAY-fix/20210121-182951
git checkout 605da67173ab7c362845b2f74c2914bfcec6db2e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

In file included from arch/sparc/include/asm/floppy.h:5,
from drivers/block/floppy.c:251:
arch/sparc/include/asm/floppy_64.h:200:13: warning: no previous prototype for 'sparc_floppy_irq' [-Wmissing-prototypes]
200 | irqreturn_t sparc_floppy_irq(int irq, void *dev_cookie)
| ^~~~~~~~~~~~~~~~
In file included from arch/sparc/include/asm/floppy.h:5,
from drivers/block/floppy.c:251:
arch/sparc/include/asm/floppy_64.h:437:6: warning: no previous prototype for 'sun_pci_fd_dma_callback' [-Wmissing-prototypes]
437 | void sun_pci_fd_dma_callback(struct ebus_dma_info *p, int event, void *cookie)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/block/floppy.c: In function 'floppy_open':
>> drivers/block/floppy.c:4125:3: error: 'UDRS' undeclared (first use in this function)
4125 | UDRS->last_checked = 0;
| ^~~~
drivers/block/floppy.c:4125:3: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/block/floppy.c:4127:3: error: implicit declaration of function 'check_disk_change'; did you mean 'bdev_disk_changed'? [-Werror=implicit-function-declaration]
4127 | check_disk_change(bdev);
| ^~~~~~~~~~~~~~~~~
| bdev_disk_changed
cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for COMPAT_BINFMT_ELF
Depends on COMPAT && BINFMT_ELF
Selected by
- COMPAT && SPARC64
WARNING: unmet direct dependencies detected for FRAME_POINTER
Depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS || MCOUNT
Selected by
- LOCKDEP && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !X86

vim +/UDRS +4125 drivers/block/floppy.c

4052
4053 /*
4054 * floppy_open check for aliasing (/dev/fd0 can be the same as
4055 * /dev/PS0 etc), and disallows simultaneous access to the same
4056 * drive with different device numbers.
4057 */
4058 static int floppy_open(struct block_device *bdev, fmode_t mode)
4059 {
4060 int drive = (long)bdev->bd_disk->private_data;
4061 int old_dev, new_dev;
4062 int try;
4063 int res = -EBUSY;
4064 char *tmp;
4065
4066 mutex_lock(&floppy_mutex);
4067 mutex_lock(&open_lock);
4068 old_dev = drive_state[drive].fd_device;
4069 if (opened_bdev[drive] && opened_bdev[drive] != bdev)
4070 goto out2;
4071
4072 if (!drive_state[drive].fd_ref && (drive_params[drive].flags & FD_BROKEN_DCL)) {
4073 set_bit(FD_DISK_CHANGED_BIT, &drive_state[drive].flags);
4074 set_bit(FD_VERIFY_BIT, &drive_state[drive].flags);
4075 }
4076
4077 drive_state[drive].fd_ref++;
4078
4079 opened_bdev[drive] = bdev;
4080
4081 res = -ENXIO;
4082
4083 if (!floppy_track_buffer) {
4084 /* if opening an ED drive, reserve a big buffer,
4085 * else reserve a small one */
4086 if ((drive_params[drive].cmos == 6) || (drive_params[drive].cmos == 5))
4087 try = 64; /* Only 48 actually useful */
4088 else
4089 try = 32; /* Only 24 actually useful */
4090
4091 tmp = (char *)fd_dma_mem_alloc(1024 * try);
4092 if (!tmp && !floppy_track_buffer) {
4093 try >>= 1; /* buffer only one side */
4094 INFBOUND(try, 16);
4095 tmp = (char *)fd_dma_mem_alloc(1024 * try);
4096 }
4097 if (!tmp && !floppy_track_buffer)
4098 fallback_on_nodma_alloc(&tmp, 2048 * try);
4099 if (!tmp && !floppy_track_buffer) {
4100 DPRINT("Unable to allocate DMA memory\n");
4101 goto out;
4102 }
4103 if (floppy_track_buffer) {
4104 if (tmp)
4105 fd_dma_mem_free((unsigned long)tmp, try * 1024);
4106 } else {
4107 buffer_min = buffer_max = -1;
4108 floppy_track_buffer = tmp;
4109 max_buffer_sectors = try;
4110 }
4111 }
4112
4113 new_dev = MINOR(bdev->bd_dev);
4114 drive_state[drive].fd_device = new_dev;
4115 set_capacity(disks[drive][ITYPE(new_dev)], floppy_sizes[new_dev]);
4116 if (old_dev != -1 && old_dev != new_dev) {
4117 if (buffer_drive == drive)
4118 buffer_track = -1;
4119 }
4120
4121 if (fdc_state[FDC(drive)].rawcmd == 1)
4122 fdc_state[FDC(drive)].rawcmd = 2;
4123
4124 if (mode & (FMODE_READ|FMODE_WRITE)) {
> 4125 UDRS->last_checked = 0;
4126 clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &drive_state[drive].flags);
> 4127 check_disk_change(bdev);
4128 if (test_bit(FD_DISK_CHANGED_BIT, &drive_state[drive].flags))
4129 goto out;
4130 if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &drive_state[drive].flags))
4131 goto out;
4132 }
4133
4134 res = -EROFS;
4135
4136 if ((mode & FMODE_WRITE) &&
4137 !test_bit(FD_DISK_WRITABLE_BIT, &drive_state[drive].flags))
4138 goto out;
4139
4140 mutex_unlock(&open_lock);
4141 mutex_unlock(&floppy_mutex);
4142 return 0;
4143 out:
4144 drive_state[drive].fd_ref--;
4145
4146 if (!drive_state[drive].fd_ref)
4147 opened_bdev[drive] = NULL;
4148 out2:
4149 mutex_unlock(&open_lock);
4150 mutex_unlock(&floppy_mutex);
4151 return res;
4152 }
4153

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25754 bytes --]