Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1791166pxk; Tue, 1 Sep 2020 07:55:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1ovfITvkm8xkGLiYMNyACc7RssM0hfpmO+aJC4K2seuD+tTfnqwnehLtK2pN2NC4cKn5s X-Received: by 2002:a17:906:393:: with SMTP id b19mr1763785eja.268.1598972150361; Tue, 01 Sep 2020 07:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972150; cv=none; d=google.com; s=arc-20160816; b=edS4cYZMDFqSxStg6nD1h7FmWr8MXifvXE3zTPcRw9o3bZqDlGtihB8OWe3NvFaVHk YR16rwWfaOP1Rw3Fq+RBbXmuqjCB3OSKLX9Fly6ZGzdNxeI5TpyU069sPHzhV38/N+Dp vOdRbx3q1A4steE6DgLyjzRb1firHoqXx5gAknFllmML2O53mnXt4AuDbd++bGrIZkJe rHaGVARzRXL4qBAo/hscY1p3N6kJCIMT2Oy7Uq6gI6RulRWuVNqD3+UIXxvHQt0svZ78 TW8SaR+btjx6ZmlcuVPfvwEL/xYboGc9HufIJYKj5x36ODCe4B/1WjAPNfVUEfTi0dOt G1PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=10tIIDIaQU2tM2K4MMC/XCa1wi00+mSmZhBFKiCpTDg=; b=UTTtM592FbP8EVo6qJ2FPKFa5evNuQgC/S1ODQejGRg0IGab9YG4C41oc9vcLQ6Wqr yPiaF1obuDQh8WS8OS2uWEoYn7dlPkb1L16ahGNzdaVFlqz0VgZC9fkeH7+yigisLKG5 BUX5678UMZ7V7NTXZ1cPUTorIPLVbZlwLh6vrNr/lx/fBvaucxvLpvSWfkL+mtTXED91 VtThw8PZrIUmZm0aZxk5MjQN/jcQmeSDOCvYIEl91Ipr85ecvOQyTl/lck9pIomubF/u mXmLt9CZuOAN9Bv2uv4dFAKoQcYN2rbu4Sc/csPPR8XONohNblOxCYfvYxlhT8/yGKGo hFFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="BZy5W/bt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr7si800707ejb.46.2020.09.01.07.55.26; Tue, 01 Sep 2020 07:55:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="BZy5W/bt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726311AbgIALbA (ORCPT + 99 others); Tue, 1 Sep 2020 07:31:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:40898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726922AbgIALZ1 (ORCPT ); Tue, 1 Sep 2020 07:25:27 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 6BCC62083B; Tue, 1 Sep 2020 11:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598958490; bh=M/gIeLcJ2zVJl2Ut67sxzpfCdDlyqzk0freIT8v084g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BZy5W/btSM8j5ieOU3Lkd/o/cf81UNFXZOs7IdZVDmDsLdhyOCvQmv5FbQCwl9H6B mgdLcEzTqQ24kpqHfwLVD04S/b+Hju8RFyN455BYX3EfRbnHDw0q9qJJnP4LrNQKjt 3fnRdPl1V7BGCkeE4TeawBf6ya8ZNspqdZPml+Uo= Date: Tue, 1 Sep 2020 13:08:38 +0200 From: Greg KH To: antoniprzybylik Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: gdm724x: gdm_tty: corrected macro by adding brackets Message-ID: <20200901110838.GA273488@kroah.com> References: <20200901104311.17270-1-antoni.przybylik@wp.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200901104311.17270-1-antoni.przybylik@wp.pl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 01, 2020 at 12:43:11PM +0200, antoniprzybylik wrote: > Such macros are dangerous. Consider following example: > #define GDM_TTY_READY(gdm) (gdm && gdm->tty_dev && gdm->port.count) > GDM_TTY_READY(a + b) > This macro will be expanded in such a way: > (a + b && a + b->tty_dev && a + b->port.count) > And it will lead to errors. This is for a pointer, no one would ever do that :) But, if you really worry about this, turn it into an inline function, that way you get the proper typedef safety, which is what something like this should really be, not a macro. thanks, greg k-h