Linux-Serial Archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hugo Villeneuve <hvilleneuve@dimonoff.com>
Subject: Re: [PATCH v3 7/8] serial: max3100: Extract to_max3100_port() helper macro
Date: Wed, 10 Apr 2024 16:55:55 +0300	[thread overview]
Message-ID: <Zhaaa1DBwVHf48oQ@smile.fi.intel.com> (raw)
In-Reply-To: <889be591-93cc-4e80-bebe-04a6f8f58c70@kernel.org>

On Wed, Apr 10, 2024 at 09:17:28AM +0200, Jiri Slaby wrote:
> On 09. 04. 24, 16:45, Andy Shevchenko wrote:
> > Instead of using container_of() explicitly, introduce a helper macro.
> > This saves a lot of lines of code.

...

> > +#define to_max3100_port(port)	container_of(port, struct max3100_port, port)
> 
> This is wrong. If you pass something other than "port" to to_max3100_port(),
> the third arg of container_of() will explode.

Then don't do that :-)

> Use an inline to avoid mistakes like this.

Sure, thanks for catching this. Should I send an update to prevent this from
happening?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-04-10 13:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 14:45 [PATCH v3 0/8] serial: max3100: Put into shape Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 1/8] serial: max3100: Enable TIOCM_LOOP Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 2/8] serial: max3100: Get crystal frequency via device property Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 3/8] serial: max3100: Remove duplicating irq field Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 4/8] serial: max3100: Switch to use dev_err_probe() Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 5/8] serial: max3100: Replace MODULE_ALIAS() with respective ID tables Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 6/8] serial: max3100: Switch to DEFINE_SIMPLE_DEV_PM_OPS() Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 7/8] serial: max3100: Extract to_max3100_port() helper macro Andy Shevchenko
2024-04-10  7:17   ` Jiri Slaby
2024-04-10 13:55     ` Andy Shevchenko [this message]
2024-04-09 14:45 ` [PATCH v3 8/8] serial: max3100: Sort headers Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zhaaa1DBwVHf48oQ@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).