Linux kernel staging patches
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Harshit Shaw <shawharshit116@gmail.com>
Cc: deller@gmx.de, tzimmermann@suse.de, chintanlike@gmail.com,
	andriy.shevchenko@intel.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: fbtft: check return value of device_create_file()
Date: Mon, 11 May 2026 12:08:00 +0200	[thread overview]
Message-ID: <2026051146-banister-shelf-414f@gregkh> (raw)
In-Reply-To: <20260511100140.4794-1-shawharshit116@gmail.com>

On Mon, May 11, 2026 at 10:01:40AM +0000, Harshit Shaw wrote:
> 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");

This sysfs file should not be there at all, can you work to remove it
and just use the "normal" debug api for logging stuff?

Also, no driver should be calling this function directly, a default
attribute group is the correct solution.  So don't paper over this
warning by just checking the error value now, do the right thing
instead.

thanks,

greg k-h

  reply	other threads:[~2026-05-11 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 10:01 [PATCH] staging: fbtft: check return value of device_create_file() Harshit Shaw
2026-05-11 10:08 ` Greg KH [this message]
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=2026051146-banister-shelf-414f@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=chintanlike@gmail.com \
    --cc=deller@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=shawharshit116@gmail.com \
    --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