Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp672873ybv; Thu, 13 Feb 2020 07:32:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxIEKoFzMPtqb0rzXOey+xpjzchgrh3YueQFFgDFtoEbCNbDevkBk9ujlwuEU7yH7x1g0Eh X-Received: by 2002:a9d:4c81:: with SMTP id m1mr13759940otf.5.1581607962945; Thu, 13 Feb 2020 07:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581607962; cv=none; d=google.com; s=arc-20160816; b=EvboS/5RAsGQq83FwrRoeAHVN7zTGgRDonC6ty8B6NVMES8RlRDdeTSgc3DI/JDqo7 EXLSH8xb4dunDOTE52bU9v32nK86z0b4gEMS1tW96YjpQ37DwEXXcPDTg+YlHaRa851H KZQOA22QP9WcBYbZoSeMQdUCuTgw8fY6ILKm+juFGePBY54LH2LVTSvEl2utZtwgAh95 FthHjlFM1D6/hqvXt1q/CtWkxahJnzqXWgWB+gXcgfg6TLJD4MxKInFCjqecWwp4EcUo nBdd0cV5i5P2E3aF0l49NFgRXmuYkO5th0CsHD86ziGRm+v+K4LDcCYfqgpaglR67BsR VFpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BfsLxeBcYn/n/lmDln6rBMWrVlDTLRYWB8HMuj/CaVo=; b=u9qloaZviM1ZE5GOZGriU7yDJPqawfB/2mq2wa8BbyA07MUGq2pGzZrsKbrrJ31tQ4 38EKRT6Mvm11DdhJNco6SlpJ4uz2w6NgBrTVTKKXN04d/s8Uw/ZRa/D9kWRQJ5yHGQaq PUiixpixP6YeHsqIV+BAVTmlKQBsUNot8/0epmfDdVtsAHKkD661l/nPz0VBidax9+6h e4Klx45R1QATxsVrXQ+aCuX3QmyN6TGMdHYSMRuGOmJsyY4lrtJQaefWS63RDznR7kk1 HlCKsRfogEcYwvLe2Vvcf8wxYHbX3fc2Ew8zPx/1QrkLl4cltE3QVBKAf3dSnwoVGoV9 Bs2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eKG9jYei; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si1232930otp.295.2020.02.13.07.32.29; Thu, 13 Feb 2020 07:32:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eKG9jYei; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387667AbgBMPbZ (ORCPT + 99 others); Thu, 13 Feb 2020 10:31:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:53338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728696AbgBMP1z (ORCPT ); Thu, 13 Feb 2020 10:27:55 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 77F2D24671; Thu, 13 Feb 2020 15:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607674; bh=4LziLDgEs1a6bdEtUIGJmGqk67KT7ZSxeXxXjuRP6yE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKG9jYeiauI+bKuFPlb/VJIp6bmPO5EsNBgP6ip4937CJcFo+Fl7wN2JIPnPcOdf5 Oa+VFnYH4ConjdeKuxWhuB7Z5OSRDB1lTuT1ddaevwh2L7RYCQfLnFC/dUrGHms2fN X/UQ5h2Tbtdn+coWVFuhBpzr1xEj6dt2wXXM7W+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Vyukov , "Gustavo A. R. Silva" , Kieran Bingham , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 82/96] media: i2c: adv748x: Fix unsafe macros Date: Thu, 13 Feb 2020 07:21:29 -0800 Message-Id: <20200213151910.010241892@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gustavo A. R. Silva commit 0d962e061abcf1b9105f88fb850158b5887fbca3 upstream. Enclose multiple macro parameters in parentheses in order to make such macros safer and fix the Clang warning below: drivers/media/i2c/adv748x/adv748x-afe.c:452:12: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses] ret = sdp_clrset(state, ADV748X_SDP_FRP, ADV748X_SDP_FRP_MASK, enable ? ctrl->val - 1 : 0); Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver") Reported-by: Dmitry Vyukov Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kieran Bingham Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/adv748x/adv748x.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -394,10 +394,10 @@ int adv748x_write_block(struct adv748x_s #define io_read(s, r) adv748x_read(s, ADV748X_PAGE_IO, r) #define io_write(s, r, v) adv748x_write(s, ADV748X_PAGE_IO, r, v) -#define io_clrset(s, r, m, v) io_write(s, r, (io_read(s, r) & ~m) | v) +#define io_clrset(s, r, m, v) io_write(s, r, (io_read(s, r) & ~(m)) | (v)) #define hdmi_read(s, r) adv748x_read(s, ADV748X_PAGE_HDMI, r) -#define hdmi_read16(s, r, m) (((hdmi_read(s, r) << 8) | hdmi_read(s, r+1)) & m) +#define hdmi_read16(s, r, m) (((hdmi_read(s, r) << 8) | hdmi_read(s, (r)+1)) & (m)) #define hdmi_write(s, r, v) adv748x_write(s, ADV748X_PAGE_HDMI, r, v) #define repeater_read(s, r) adv748x_read(s, ADV748X_PAGE_REPEATER, r) @@ -405,11 +405,11 @@ int adv748x_write_block(struct adv748x_s #define sdp_read(s, r) adv748x_read(s, ADV748X_PAGE_SDP, r) #define sdp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_SDP, r, v) -#define sdp_clrset(s, r, m, v) sdp_write(s, r, (sdp_read(s, r) & ~m) | v) +#define sdp_clrset(s, r, m, v) sdp_write(s, r, (sdp_read(s, r) & ~(m)) | (v)) #define cp_read(s, r) adv748x_read(s, ADV748X_PAGE_CP, r) #define cp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_CP, r, v) -#define cp_clrset(s, r, m, v) cp_write(s, r, (cp_read(s, r) & ~m) | v) +#define cp_clrset(s, r, m, v) cp_write(s, r, (cp_read(s, r) & ~(m)) | (v)) #define tx_read(t, r) adv748x_read(t->state, t->page, r) #define tx_write(t, r, v) adv748x_write(t->state, t->page, r, v)