From: Harshit Shaw <shawharshit116@gmail.com>
To: deller@gmx.de
Cc: tzimmermann@suse.de, chintanlike@gmail.com,
andriy.shevchenko@intel.com, gregkh@linuxfoundation.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Harshit Shaw <shawharshit116@gmail.com>
Subject: [PATCH] staging: fbtft: check return value of device_create_file()
Date: Mon, 11 May 2026 10:01:40 +0000 [thread overview]
Message-ID: <20260511100140.4794-1-shawharshit116@gmail.com> (raw)
device_create_file() can fail but its return value was being
ignored in fbtft_sysfs_init(). Check the return value and
emit a warning if sysfs file creation fails.
Signed-off-by: Harshit Shaw <shawharshit116@gmail.com>
---
drivers/staging/fbtft/fbtft-sysfs.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
index d05599d80011..cc6dbaeb6043 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
@@ -204,14 +204,21 @@ static struct device_attribute debug_device_attr =
void fbtft_sysfs_init(struct fbtft_par *par)
{
struct device *dev;
+ int ret;
dev = dev_of_fbinfo(par->info);
if (!dev)
return;
- device_create_file(dev, &debug_device_attr);
- if (par->gamma.curves && par->fbtftops.set_gamma)
- device_create_file(dev, &gamma_device_attrs[0]);
+ ret = device_create_file(dev, &debug_device_attr);
+ if (ret)
+ dev_warn(dev, "failed to create debug sysfs entry\n");
+
+ if (par->gamma.curves && par->fbtftops.set_gamma) {
+ ret = device_create_file(dev, &gamma_device_attrs[0]);
+ if (ret)
+ dev_warn(dev, "failed to create gamma sysfs entry\n");
+ }
}
void fbtft_sysfs_exit(struct fbtft_par *par)
--
2.53.0
next reply other threads:[~2026-05-11 10:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 10:01 Harshit Shaw [this message]
2026-05-11 10:08 ` [PATCH] staging: fbtft: check return value of device_create_file() Greg KH
2026-05-11 11:46 ` Dan Carpenter
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=20260511100140.4794-1-shawharshit116@gmail.com \
--to=shawharshit116@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=chintanlike@gmail.com \
--cc=deller@gmx.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=tzimmermann@suse.de \
/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