From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2C2E35C19F for ; Tue, 14 Jul 2026 11:31:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784028715; cv=none; b=Qi3anHH3IB54FEuin4ACNucGoN8/+qKwCJF0CcxPFI95OcYXxc5RCyr7qmpzgspiQu3Oq+2jrp7NaGPkdFjMlEpCIoFTLHOc14s3ibKPx8NoJMGu9Uczn2Gmt93icDC2WRui2AM+LDoxCJJi2RxQp5oW+NnqXWgc1aLxePc2u28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784028715; c=relaxed/simple; bh=biO2VDvvuMrg2uvDOeIUh5S1pDVpoUHuMMBFpMiL5jU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GLGd6jm53WMULWG5HH6ClRvH+gjLWmNqe925SSRw7ojO5R337DkNVZcyc46KW9lhVjgwBNJ+7k1X1l4P2GZhfhs/MZAXMQ2eWzOuluoVyS0gnf73Mo2GxBGAJQhrTL8i2yT+J0xCwMwhDXjMQLWEmY384oQraCes9XPcnTd7kQI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fltIsD98; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fltIsD98" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c9fe3c9bd5fso689514a12.0 for ; Tue, 14 Jul 2026 04:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784028710; x=1784633510; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Y0H1G5WZdR9SN2z823rVvQJ9X5UKno+8iIWeLBusZtg=; b=fltIsD98C6WwW35+fnMCah7EQCrx1Xn/JkgE20wqUNZTSaAARsguva9Ro5U0bElYMn H3auFQS+1JtrnUB9MLco8PsHNiR+m6OQSbl8zK4inpXg+GT1mjgDw+VglG8p569so6s2 7UEnxlzbs5x6KIInaNSNG3W2RBqedIeXn+5us7wme12mSUGuqVIDPysy6+fgGXi0E1d8 xT59dm4/r6qmh/9oWHbjxFMPeJgkARTiY4bDDNdGb9kiwANgBLyfQoMzc0ZUsnViBw6F QOs4KE+IYPXnQKvhEWtFy5MPqGhYUspU0btETSdtnUs8c0zm1R4Y35zOFp2hVME3f9cC 94OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784028710; x=1784633510; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Y0H1G5WZdR9SN2z823rVvQJ9X5UKno+8iIWeLBusZtg=; b=Lw0ppUTfAnQ42dHA77BGMHZl5tYfJcCP8Lc+M1YLJMD22RgJcBatHzpkzDBswtuETV SL1EwLFEEPcRyj2dX0HaAF/wG8S8L9kjb/MA+9aSQUXFHS6GuPvh4+n5FDFKtbJFYkeJ Zdumn3Nuxx8uPYXom8Pu8+LyemQXjRxVEttqrlmtsdjemH4WBPOdVL/KV82PxfnvwBEX Db+Z416DtaSVArr7eZomS4ZXTuEx1NiCTkWwTQHhVZ0KUKMLeM+MmcdPQCx14KWbH7Hd 8MBQAXFatGJF1F6EgfvmGQOCnZWLzaQ0fxHu+IPKp8BYPpbFvMf/OVzJxxjsKbqc4LeG fFow== X-Forwarded-Encrypted: i=1; AHgh+RovZMiSSLR5enNSnypsuaCdL9Js9JZ6HjtLfbOPpnx35VgdsMuUWkTgcrqjiCjOqgd9EAwooMfKT3OuJts=@vger.kernel.org X-Gm-Message-State: AOJu0Ywco5aTa/F23GuPZzfawHrmOx+PJzKZaWLX7En31Z/vtAonWGHY AAUGKwIpyTwWfnINZYAsLEu52V/KCDiDYe0RQfJPPV0vc8ZGxTSZwtg= X-Gm-Gg: AfdE7clmguN1Fl9DwUPm3no1t1ve0VUkTG1lNMRBYQ9dMrjFkJt36CV90qvKivvCNr+ 73iEdFL3Luf6aSYbHpbtpJ0j/sJ60Rd32DdB/YGosxNI1ejsBZwmyXJITj/nUTIMZakVZs3J6HG T1x4VmcqAQTIIBdi/7n+l8AnYL+xG7VieJGlR+9XAwsfcheehNdMjsgJDbp5Kas7Q+0XcTPELq8 keB1VFchEbrj7oi68Vtv4c+o6qRiZiQC18iXLp198C1raT/rNmJ09yZX1uPJyB9+gD2vNp733ne 7be6rhaCIAS2Oq/O4IzMgjuVwqpfRTneJDVSSqyjgBV8A1EzwXekpXxhqqClOeRa/gBP8g143Su 9xdTWKvovB3+fP0PLxLGDr13CLYMBwx/Q4EIrqvxit1JAHOpt+5Ka0pLdNa1MHKO+8sOuThqeSY xx1De6/5LfSM1WqIBMeI42KK3/5Tiqt9/UfFEyUPwiH5UQs4P7/aYY X-Received: by 2002:a05:6300:2189:b0:3bf:8a0e:dd99 with SMTP id adf61e73a8af0-3c0f0990bcfmr19424002637.17.1784028710394; Tue, 14 Jul 2026 04:31:50 -0700 (PDT) Received: from localhost.localdomain ([101.0.63.168]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f72a6sm95357368eec.1.2026.07.14.04.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 04:31:49 -0700 (PDT) From: Nikhil Gautam To: Jonathan Cameron Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Stefan Windfeldt-Prytz , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Nikhil Gautam Subject: [PATCH v3 2/4] iio: light: opt4001: Fix incompatible pointer type passed to div_u64_rem() Date: Tue, 14 Jul 2026 17:01:32 +0530 Message-Id: <20260714113134.3445-3-nikhilgtr@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260714113134.3445-1-nikhilgtr@gmail.com> References: <20260714113134.3445-1-nikhilgtr@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit div_u64_rem() takes a u32 * for the remainder but is passed val2, which is an int *. There is no functional impact as int and u32 have the same size and representation on all supported architectures and the remainder is always smaller than the divisor, so it fits in the positive range of int. Fix the type mismatch by using a local u32 for the remainder and assigning the result to *val2. Fixes: 9a9608418292 ("iio: light: Add support for TI OPT4001 light sensor") Signed-off-by: Nikhil Gautam --- drivers/iio/light/opt4001.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/opt4001.c b/drivers/iio/light/opt4001.c index 66563000d081..a0f174888384 100644 --- a/drivers/iio/light/opt4001.c +++ b/drivers/iio/light/opt4001.c @@ -173,6 +173,7 @@ static int opt4001_read_lux_value(struct iio_dev *indio_dev, u8 crc; u8 calc_crc; u64 lux_raw; + u32 rem; int ret; ret = regmap_read(chip->regmap, OPT4001_LIGHT1_MSB, &light1); @@ -199,8 +200,8 @@ static int opt4001_read_lux_value(struct iio_dev *indio_dev, lux_raw = lux_raw << exp; lux_raw = lux_raw * chip->chip_info->mul; - *val = div_u64_rem(lux_raw, chip->chip_info->div, val2); - *val2 = *val2 * 100; + *val = div_u64_rem(lux_raw, chip->chip_info->div, &rem); + *val2 = rem * 100; return IIO_VAL_INT_PLUS_NANO; } -- 2.39.5