From: Krzysztof Kozlowski <krzk@kernel.org>
To: Vishnu Saini <vishnu.saini@oss.qualcomm.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Tony <syyang@lontium.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, prahlad.valluru@oss.qualcomm.com,
Prahlad Valluru <vvalluru@qti.qualcomm.com>
Subject: Re: [PATCH v2 2/2] drm/bridge: add support for lontium lt8713sx bridge driver
Date: Tue, 18 Nov 2025 08:37:22 +0100 [thread overview]
Message-ID: <c931853e-faa6-41ae-89a8-d22544a9da9c@kernel.org> (raw)
In-Reply-To: <20251118-lt8713sx-bridge-driver-v2-2-25ad49280a11@oss.qualcomm.com>
On 18/11/2025 05:37, Vishnu Saini wrote:
> +static void lt8713sx_reset(struct lt8713sx *lt8713sx)
> +{
> + pr_debug("reset bridge.\n");
> + gpiod_set_value_cansleep(lt8713sx->reset_gpio, 1);
> + msleep(20);
> +
> + gpiod_set_value_cansleep(lt8713sx->reset_gpio, 0);
> + msleep(20);
> +
> + gpiod_set_value_cansleep(lt8713sx->reset_gpio, 1);
> + msleep(20);
> + pr_debug("reset done.\n");
No, it is not done, because you kept the device in the reset. 1 is
reset. Don't mix up line and logical signals.
> +}
> +
> +static int lt8713sx_regulator_init(struct lt8713sx *lt8713sx)
> +{
> + int ret;
> +
> + lt8713sx->supplies[0].supply = "vdd";
> + lt8713sx->supplies[1].supply = "vcc";
> +
> + ret = devm_regulator_bulk_get(lt8713sx->dev, 2, lt8713sx->supplies);
> + if (ret < 0)
> + return dev_err_probe(lt8713sx->dev, ret, "failed to get regulators\n");
> +
> + ret = regulator_set_load(lt8713sx->supplies[0].consumer, 200000);
> + if (ret < 0)
> + return dev_err_probe(lt8713sx->dev, ret, "failed to set regulator load\n");
> +
> + return 0;
> +}
> +
> +static int lt8713sx_regulator_enable(struct lt8713sx *lt8713sx)
> +{
> + int ret;
> +
> + ret = regulator_enable(lt8713sx->supplies[0].consumer);
> + if (ret < 0)
> + return dev_err_probe(lt8713sx->dev, ret, "failed to enable vdd regulator\n");
> +
> + usleep_range(1000, 10000);
> +
> + ret = regulator_enable(lt8713sx->supplies[1].consumer);
> + if (ret < 0) {
> + regulator_disable(lt8713sx->supplies[0].consumer);
> + return dev_err_probe(lt8713sx->dev, ret, "failed to enable vcc regulator\n");
> + }
> + return 0;
> +}
> +
> +static int lt8713sx_gpio_init(struct lt8713sx *lt8713sx)
> +{
> + struct device *dev = lt8713sx->dev;
> +
> + lt8713sx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> + if (IS_ERR(lt8713sx->reset_gpio))
> + return dev_err_probe(dev, PTR_ERR(lt8713sx->reset_gpio),
> + "failed to acquire reset gpio\n");
> +
> + /* power enable gpio */
> + lt8713sx->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
> + if (IS_ERR(lt8713sx->enable_gpio))
> + return dev_err_probe(dev, PTR_ERR(lt8713sx->enable_gpio),
> + "failed to acquire enable gpio\n");
> + return 0;
> +}
> +
> +static ssize_t lt8713sx_firmware_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t len)
> +{
> + struct lt8713sx *lt8713sx = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = lt8713sx_firmware_update(lt8713sx);
> + if (ret < 0)
> + return ret;
> + return len;
> +}
> +
> +static DEVICE_ATTR_WO(lt8713sx_firmware);
> +
> +static struct attribute *lt8713sx_attrs[] = {
> + &dev_attr_lt8713sx_firmware.attr,
> + NULL,
> +};
> +
> +static const struct attribute_group lt8713sx_attr_group = {
> + .attrs = lt8713sx_attrs,
> +};
> +
> +static const struct attribute_group *lt8713sx_attr_groups[] = {
> + <8713sx_attr_group,
> + NULL,
> +};
> +
> +static int lt8713sx_probe(struct i2c_client *client)
> +{
> + struct lt8713sx *lt8713sx;
> + struct device *dev = &client->dev;
> + int ret;
> +
> + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
> + return dev_err_probe(dev, -ENODEV, "device doesn't support I2C\n");
> +
> + lt8713sx = devm_kzalloc(dev, sizeof(*lt8713sx), GFP_KERNEL);
> + if (!lt8713sx)
> + return dev_err_probe(dev, -ENOMEM, "failed to allocate lt8713sx struct\n");
> +
I did not ask for dev_err_probe here. Do you see such pattern anywhere?
No, because there are never error messages on memory allocation (see
coccinelle). Drop.
Please run standard kernel tools for static analysis, like coccinelle,
smatch and sparse, and fix reported warnings. Also please check for
warnings when building with W=1 for gcc and clang. Most of these
commands (checks or W=1 build) can build specific targets, like some
directory, to narrow the scope to only your code. The code here looks
like it needs a fix. Feel free to get in touch if the warning is not clear.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-11-18 7:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 4:37 [PATCH v2 0/2] Add lontium lt8713sx bridge driver Vishnu Saini
2025-11-18 4:37 ` [PATCH v2 1/2] dt-bindings: bridge: lt8713sx: Add bindings Vishnu Saini
2025-11-18 7:34 ` Krzysztof Kozlowski
2025-11-18 4:37 ` [PATCH v2 2/2] drm/bridge: add support for lontium lt8713sx bridge driver Vishnu Saini
2025-11-18 7:37 ` Krzysztof Kozlowski [this message]
2025-12-28 7:18 ` Vishnu Saini
2025-11-21 12:55 ` Dmitry Baryshkov
2025-12-28 7:45 ` Vishnu Saini
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=c931853e-faa6-41ae-89a8-d22544a9da9c@kernel.org \
--to=krzk@kernel.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=prahlad.valluru@oss.qualcomm.com \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=syyang@lontium.com \
--cc=tzimmermann@suse.de \
--cc=vishnu.saini@oss.qualcomm.com \
--cc=vvalluru@qti.qualcomm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.