hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/drivers/watchdog/pcwd_usb.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * Berkshire USB-PC Watchdog Card Driver
34 *
....@@ -9,11 +10,6 @@
910 * Matt Domsch <Matt_Domsch@dell.com>,
1011 * Rob Radez <rob@osinvestor.com>,
1112 * Greg Kroah-Hartman <greg@kroah.com>
12
- *
13
- * This program is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU General Public License
15
- * as published by the Free Software Foundation; either version
16
- * 2 of the License, or (at your option) any later version.
1713 *
1814 * Neither Wim Van Sebroeck nor Iguana vzw. admit liability nor
1915 * provide warranty for any of this software. This material is
....@@ -329,7 +325,8 @@
329325 static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd,
330326 int *temperature)
331327 {
332
- unsigned char msb, lsb;
328
+ unsigned char msb = 0x00;
329
+ unsigned char lsb = 0x00;
333330
334331 usb_pcwd_send_command(usb_pcwd, CMD_READ_TEMP, &msb, &lsb);
335332
....@@ -345,7 +342,8 @@
345342 static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd,
346343 int *time_left)
347344 {
348
- unsigned char msb, lsb;
345
+ unsigned char msb = 0x00;
346
+ unsigned char lsb = 0x00;
349347
350348 /* Read the time that's left before rebooting */
351349 /* Note: if the board is not yet armed then we will read 0xFFFF */
....@@ -456,7 +454,7 @@
456454
457455 usb_pcwd_keepalive(usb_pcwd_device);
458456 }
459
- /* fall through */
457
+ fallthrough;
460458
461459 case WDIOC_GETTIMEOUT:
462460 return put_user(heartbeat, p);
....@@ -485,7 +483,7 @@
485483 /* Activate */
486484 usb_pcwd_start(usb_pcwd_device);
487485 usb_pcwd_keepalive(usb_pcwd_device);
488
- return nonseekable_open(inode, file);
486
+ return stream_open(inode, file);
489487 }
490488
491489 static int usb_pcwd_release(struct inode *inode, struct file *file)
....@@ -524,7 +522,7 @@
524522
525523 static int usb_pcwd_temperature_open(struct inode *inode, struct file *file)
526524 {
527
- return nonseekable_open(inode, file);
525
+ return stream_open(inode, file);
528526 }
529527
530528 static int usb_pcwd_temperature_release(struct inode *inode, struct file *file)
....@@ -554,6 +552,7 @@
554552 .llseek = no_llseek,
555553 .write = usb_pcwd_write,
556554 .unlocked_ioctl = usb_pcwd_ioctl,
555
+ .compat_ioctl = compat_ptr_ioctl,
557556 .open = usb_pcwd_open,
558557 .release = usb_pcwd_release,
559558 };
....@@ -588,9 +587,8 @@
588587 static inline void usb_pcwd_delete(struct usb_pcwd_private *usb_pcwd)
589588 {
590589 usb_free_urb(usb_pcwd->intr_urb);
591
- if (usb_pcwd->intr_buffer != NULL)
592
- usb_free_coherent(usb_pcwd->udev, usb_pcwd->intr_size,
593
- usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
590
+ usb_free_coherent(usb_pcwd->udev, usb_pcwd->intr_size,
591
+ usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
594592 kfree(usb_pcwd);
595593 }
596594
....@@ -660,7 +658,7 @@
660658
661659 /* set up the memory buffer's */
662660 usb_pcwd->intr_buffer = usb_alloc_coherent(udev, usb_pcwd->intr_size,
663
- GFP_ATOMIC, &usb_pcwd->intr_dma);
661
+ GFP_KERNEL, &usb_pcwd->intr_dma);
664662 if (!usb_pcwd->intr_buffer) {
665663 pr_err("Out of memory\n");
666664 goto error;