Linux-Devicetree Archive mirror
 help / color / mirror / Atom feed
From: Christoph Fritz <christoph.fritz@hexdev.de>
To: Simon Horman <horms@kernel.org>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	 Linus Walleij <linus.walleij@linaro.org>,
	Andreas Lauser <andreas.lauser@mercedes-benz.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Pavel Pisa <pisa@cmp.felk.cvut.cz>,
	linux-can@vger.kernel.org,  netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-input@vger.kernel.org,
	 linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 07/12] can: Add support for serdev LIN adapters
Date: Wed, 08 May 2024 10:37:54 +0200	[thread overview]
Message-ID: <7e321216b92651680f0b9adafc11afe27c8a49c3.camel@hexdev.de> (raw)
In-Reply-To: <20240504131331.GL3167983@kernel.org>

On Sat, 2024-05-04 at 14:13 +0100, Simon Horman wrote:
> On Thu, May 02, 2024 at 09:55:29AM +0200, Christoph Fritz wrote:
> > This commit introduces LIN-Bus support for UART devices equipped with
> > LIN transceivers, utilizing the Serial Device Bus (serdev) interface.
> > 
> > For more details on an adapter, visit: https://hexdev.de/hexlin#tty
> > 
> > Signed-off-by: Christoph Fritz <christoph.fritz@hexdev.de>
> 
> ...
> 
> > diff --git a/drivers/net/can/lin-serdev.c b/drivers/net/can/lin-serdev.c
> 
> ...
> 
> > +static int linser_probe(struct serdev_device *serdev)
> > +{
> > +	struct linser_priv *priv;
> > +	int ret;
> > +
> > +	priv = devm_kzalloc(&serdev->dev, sizeof(*priv), GFP_KERNEL);
> > +	if (!priv)
> > +		return -ENOMEM;
> > +
> > +	ret = kfifo_alloc(&priv->rx_fifo, LINSER_RX_FIFO_SIZE, GFP_KERNEL);
> > +	if (ret)
> > +		return ret;
> > +
> > +	INIT_DELAYED_WORK(&priv->rx_work, linser_process_delayed);
> > +
> > +	priv->serdev = serdev;
> > +	serdev_device_set_drvdata(serdev, priv);
> > +	serdev_device_set_client_ops(serdev, &linser_ops);
> > +
> > +	ret = serdev_device_open(serdev);
> > +	if (ret) {
> > +		dev_err(&serdev->dev, "Unable to open device\n");
> > +		goto err_open;
> > +	}
> > +
> > +	serdev_device_set_flow_control(serdev, false);
> > +	serdev_device_set_break_detection(serdev, true);
> > +	linser_derive_timings(priv, LIN_DEFAULT_BAUDRATE);
> > +
> > +	mutex_init(&priv->resp_lock);
> > +
> > +	priv->lin_dev = register_lin(&serdev->dev, &linser_lindev_ops);
> > +	if (IS_ERR_OR_NULL(priv->lin_dev)) {
> > +		ret = PTR_ERR(priv->lin_dev);
> 
> As per my feedback on an earlier patch in the series,
> in the case where priv->lin_dev is NULL,
> this will result in the function returning 0.
> Is that ok?
> 
> Flagged by Smatch

IS_ERR_OR_NULL() gets IS_ERR() in upcoming v4

Thanks
  -- Christoph

> 
> > +		goto err_register_lin;
> > +	}
> > +
> > +	serdev_device_close(serdev);
> > +	priv->is_stopped = true;
> > +
> > +	return 0;
> > +
> > +err_register_lin:
> > +	serdev_device_close(serdev);
> > +err_open:
> > +	kfifo_free(&priv->rx_fifo);
> > +	return ret;
> > +}
> 
> ...


  reply	other threads:[~2024-05-08  8:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02  7:55 [PATCH v2 00/12] LIN Bus support for Linux Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 01/12] can: Add LIN bus as CAN abstraction Christoph Fritz
2024-05-04 12:49   ` Simon Horman
2024-05-08  8:37     ` Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 02/12] HID: hexLIN: Add support for USB LIN bus adapter Christoph Fritz
2024-05-02  8:30   ` Jiri Slaby
2024-05-02 10:41     ` Christoph Fritz
2024-05-04 12:58   ` Simon Horman
2024-05-08  8:37     ` Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 03/12] tty: serdev: Add flag buffer aware receive_buf_fp() Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 04/12] tty: serdev: Add method to enable break flags Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 05/12] dt-bindings: vendor-prefixes: Add hexDEV Christoph Fritz
2024-05-02  8:56   ` Krzysztof Kozlowski
2024-05-02  7:55 ` [PATCH v2 06/12] dt-bindings: net/can: Add serial (serdev) LIN adapter Christoph Fritz
2024-05-02  9:01   ` Krzysztof Kozlowski
2024-05-02  9:31   ` Rob Herring (Arm)
2024-05-02 11:03     ` Christoph Fritz
2024-05-02 15:03       ` Rob Herring
2024-05-02  7:55 ` [PATCH v2 07/12] can: Add support for serdev LIN adapters Christoph Fritz
2024-05-02  8:44   ` Jiri Slaby
2024-05-02 18:19     ` Christoph Fritz
2024-05-04 13:13   ` Simon Horman
2024-05-08  8:37     ` Christoph Fritz [this message]
2024-05-02  7:55 ` [PATCH v2 08/12] can: lin: Add special frame id for rx offload config Christoph Fritz
2024-05-02 10:27   ` Krzysztof Kozlowski
2024-05-02 17:58     ` Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 09/12] can: bcm: Add LIN answer offloading for responder mode Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 10/12] can: lin: Handle rx offload config frames Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 11/12] can: lin: Support setting LIN mode Christoph Fritz
2024-05-02  7:55 ` [PATCH v2 12/12] HID: hexLIN: Implement ability to update lin mode Christoph Fritz

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=7e321216b92651680f0b9adafc11afe27c8a49c3.camel@hexdev.de \
    --to=christoph.fritz@hexdev.de \
    --cc=andreas.lauser@mercedes-benz.com \
    --cc=bentiss@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=horms@kernel.org \
    --cc=jikos@kernel.org \
    --cc=jirislaby@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pisa@cmp.felk.cvut.cz \
    --cc=robh@kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=sre@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).