Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86: p2sb: Use pci_resource_n() in p2sb_read_bar0()

Accesses to resource[] member of struct pci_dev shall be wrapped with
pci_resource_n() for future compatibility. Call the helper function in
p2sb_read_bar0().

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240108062059.3583028-3-shinichiro.kawasaki@wdc.com
Tested-by Klara Modin <klarasmodin@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Shin'ichiro Kawasaki and committed by
Hans de Goede
9e054ed0 5913320e

+1 -1
+1 -1
drivers/platform/x86/p2sb.c
··· 65 65 /* Copy resource from the first BAR of the device in question */ 66 66 static void p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem) 67 67 { 68 - struct resource *bar0 = &pdev->resource[0]; 68 + struct resource *bar0 = pci_resource_n(pdev, 0); 69 69 70 70 /* Make sure we have no dangling pointers in the output */ 71 71 memset(mem, 0, sizeof(*mem));