Re: [PATCH 2/3] drivers: nubus: Fix use of assignment in if condition in nubus_add_board() in nubus.c

From: kernel test robot
Date: Thu Oct 03 2024 - 06:53:39 EST


Hi Sayyad,

kernel test robot noticed the following build errors:

[auto build test ERROR on gerg-m68knommu/for-next]
[also build test ERROR on linus/master v6.12-rc1 next-20241003]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Sayyad-Abid/drivers-nubus-Fix-use-of-tabs-in-nubus_get_vendorinfo-and-nubus_add_board-in-nubus-c/20241002-214920
base: https://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git for-next
patch link: https://lore.kernel.org/r/20241002132820.402583-3-sayyad.abid16%40gmail.com
patch subject: [PATCH 2/3] drivers: nubus: Fix use of assignment in if condition in nubus_add_board() in nubus.c
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20241003/202410031850.v2wyYvLv-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241003/202410031850.v2wyYvLv-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410031850.v2wyYvLv-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

drivers/nubus/nubus.c: In function 'nubus_add_board':
>> drivers/nubus/nubus.c:739:9: error: expected ';' before 'if'
739 | if (board == NULL)
| ^~

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]


vim +739 drivers/nubus/nubus.c

723
724 static void __init nubus_add_board(int slot, int bytelanes)
725 {
726 struct nubus_board *board;
727 unsigned char *rp;
728 unsigned long dpat;
729 struct nubus_dir dir;
730 struct nubus_dirent ent;
731 int prev_resid = -1;
732
733 /* Move to the start of the format block */
734 rp = nubus_rom_addr(slot);
735 nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes);
736
737 /* Actually we should probably panic if this fails */
738 board = kzalloc(sizeof(*board), GFP_ATOMIC)
> 739 if (board == NULL)
740 return;
741 board->fblock = rp;
742
743 /* Dump the format block for debugging purposes */
744 pr_debug("Slot %X, format block at 0x%p:\n", slot, rp);
745 pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
746 pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
747 pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
748 pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
749 pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
750 pr_debug("%08lx\n", nubus_get_rom(&rp, 4, bytelanes));
751 pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
752 pr_debug("%02lx\n", nubus_get_rom(&rp, 1, bytelanes));
753 rp = board->fblock;
754
755 board->slot = slot;
756 board->slot_addr = (unsigned long)nubus_slot_addr(slot);
757 board->doffset = nubus_get_rom(&rp, 4, bytelanes);
758 /* rom_length is *supposed* to be the total length of the
759 * ROM. In practice it is the "amount of ROM used to compute
760 * the CRC." So some jokers decide to set it to zero and
761 * set the crc to zero so they don't have to do any math.
762 * See the Performa 460 ROM, for example. Those Apple "engineers".
763 */
764 board->rom_length = nubus_get_rom(&rp, 4, bytelanes);
765 board->crc = nubus_get_rom(&rp, 4, bytelanes);
766 board->rev = nubus_get_rom(&rp, 1, bytelanes);
767 board->format = nubus_get_rom(&rp, 1, bytelanes);
768 board->lanes = bytelanes;
769
770 /* Directory offset should be small and negative... */
771 if (!(board->doffset & 0x00FF0000))
772 pr_warn("Slot %X: Dodgy doffset!\n", slot);
773 dpat = nubus_get_rom(&rp, 4, bytelanes);
774 if (dpat != NUBUS_TEST_PATTERN)
775 pr_warn("Slot %X: Wrong test pattern %08lx!\n", slot, dpat);
776
777 /*
778 * I wonder how the CRC is meant to work -
779 * any takers ?
780 * CSA: According to MAC docs, not all cards pass the CRC anyway,
781 * since the initial Macintosh ROM releases skipped the check.
782 */
783
784 /* Set up the directory pointer */
785 board->directory = board->fblock;
786 nubus_move(&board->directory, nubus_expand32(board->doffset),
787 board->lanes);
788
789 nubus_get_root_dir(board, &dir);
790
791 /* We're ready to rock */
792 pr_debug("Slot %X resources:\n", slot);
793
794 /* Each slot should have one board resource and any number of
795 * functional resources. So we'll fill in some fields in the
796 * struct nubus_board from the board resource, then walk down
797 * the list of functional resources, spinning out a nubus_rsrc
798 * for each of them.
799 */
800 if (nubus_readdir(&dir, &ent) == -1) {
801 /* We can't have this! */
802 pr_err("Slot %X: Board resource not found!\n", slot);
803 kfree(board);
804 return;
805 }
806
807 if (ent.type < 1 || ent.type > 127)
808 pr_warn("Slot %X: Board resource ID is invalid!\n", slot);
809
810 board->procdir = nubus_proc_add_board(board);
811
812 nubus_get_board_resource(board, slot, &ent);
813
814 while (nubus_readdir(&dir, &ent) != -1) {
815 struct nubus_rsrc *fres;
816
817 fres = nubus_get_functional_resource(board, slot, &ent);
818 if (fres == NULL)
819 continue;
820
821 /* Resources should appear in ascending ID order. This sanity
822 * check prevents duplicate resource IDs.
823 */
824 if (fres->resid <= prev_resid) {
825 kfree(fres);
826 continue;
827 }
828 prev_resid = fres->resid;
829
830 list_add_tail(&fres->list, &nubus_func_rsrcs);
831 }
832
833 if (nubus_device_register(board))
834 put_device(&board->dev);
835 }
836

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki