From 95f7eaa29a23fb4d0a47962a43f6d72db89b03a7 Mon Sep 17 00:00:00 2001
From: Jay Fang <f.fangjian@huawei.com>
Date: Mon, 9 Aug 2021 20:18:17 +0800
Subject: [PATCH 107/109] spi: hisi-kunpeng: Fix Woverflow warning on
 conversion

mainline inclusion
from mainline-v5.13-rc1
commit 9a446cf97af70ee81ba177703b67ac4955a5edcc
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8DDF5
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a446cf97af70ee81ba177703b67ac4955a5edcc

----------------------------------------------------------------------

Fix warning Woverflow on type conversion reported on x86_64:

  drivers/spi/spi-hisi-kunpeng.c:361:9: warning: conversion from 'long unsigned int' to 'u32'
  {aka 'unsigned int'} changes value from '18446744073709551600' to '4294967280' [-Woverflow]

The registers are 32 bit, so fix by casting to u32.

Fixes: c770d8631e18 ("spi: Add HiSilicon SPI Controller Driver for Kunpeng SoCs")
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/1617762660-54681-1-git-send-email-f.fangjian@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
---
 drivers/spi/spi-hisi-kunpeng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c
index ea87b4fba5d6..c0db9b5e37ea 100644
--- a/drivers/spi/spi-hisi-kunpeng.c
+++ b/drivers/spi/spi-hisi-kunpeng.c
@@ -358,7 +358,7 @@ static int hisi_spi_transfer_one(struct spi_controller *master,
 	smp_mb();
 
 	/* Enable all interrupts and the controller */
-	writel(~IMR_MASK, hs->regs + HISI_SPI_IMR);
+	writel(~(u32)IMR_MASK, hs->regs + HISI_SPI_IMR);
 	writel(1, hs->regs + HISI_SPI_ENR);
 
 	return 1;
-- 
2.23.0

