From patchwork Thu Nov 5 04:46:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 7557271 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E32E9F36A for ; Thu, 5 Nov 2015 04:47:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EBCC2085C for ; Thu, 5 Nov 2015 04:47:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B0B12085B for ; Thu, 5 Nov 2015 04:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965760AbbKEEqx (ORCPT ); Wed, 4 Nov 2015 23:46:53 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:58234 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964903AbbKEEqv (ORCPT ); Wed, 4 Nov 2015 23:46:51 -0500 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 90E5513FDAD; Thu, 5 Nov 2015 04:46:50 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 80FA713FDCD; Thu, 5 Nov 2015 04:46:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from drakthul.qualcomm.com (rrcs-67-52-130-30.west.biz.rr.com [67.52.130.30]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 86FD713FDAD; Thu, 5 Nov 2015 04:46:49 +0000 (UTC) From: Sinan Kaya To: linux-scsi@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com Cc: Sinan Kaya , Doug Gilbert , "James E.J. Bottomley" , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] scsi: fix compiler warning for sg Date: Wed, 4 Nov 2015 23:46:28 -0500 Message-Id: <1446698789-19308-3-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1446698789-19308-1-git-send-email-okaya@codeaurora.org> References: <1446698789-19308-1-git-send-email-okaya@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The MULDIV macro has been designed for small numbers. It emits an overflow warning on 64 bit systems. This patch places type casts in the parameters to fix the compiler warning. Signed-off-by: Sinan Kaya --- drivers/scsi/sg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 9d7b7db..eb2739d 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -88,7 +88,10 @@ static void sg_proc_cleanup(void); * Of course an overflow is inavoidable if the result of muldiv doesn't fit * in 32 bits. */ -#define MULDIV(X,MUL,DIV) ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL)) +static inline u64 MULDIV(u64 X, u32 MUL, u32 DIV) +{ + return ((((X % DIV) * MUL) / DIV) + ((X / DIV) * MUL)); +} #define SG_DEFAULT_TIMEOUT MULDIV(SG_DEFAULT_TIMEOUT_USER, HZ, USER_HZ)