public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Marek Olšák" <maraeo@gmail.com>
Cc: javierm@redhat.com, dri-devel@lists.freedesktop.org,
	Helge Deller <deller@gmx.de>, Jani Nikula <jani.nikula@intel.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Sui Jingfeng <suijingfeng@loongson.cn>,
	stable@vger.kernel.org
Subject: Re: [PATCH] firmware: sysfb: Fix reference count of sysfb parent device
Date: Tue, 2 Jul 2024 09:17:57 +0200	[thread overview]
Message-ID: <aa9410e7-1ad8-49f4-a31e-59e7d9543421@suse.de> (raw)
In-Reply-To: <CAAxE2A68QveD4nNa_OyQQHYSdbvArck6oWnV7YsmWC89B8x=yA@mail.gmail.com>

Hi

Am 28.06.24 um 20:54 schrieb Marek Olšák:
> Hi Thomas,
>
> FYI, this doesn't fix the issue of lightdm not being able to start for me.

Of course, that's expected. It's a different bug.

Best regards
Thomas

>
> Marek
>
>
> Marek
>
> On Tue, Jun 25, 2024 at 4:18 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Retrieving the system framebuffer's parent device in sysfb_init()
>> increments the parent device's reference count. Hence release the
>> reference before leaving the init function.
>>
>> Adding the sysfb platform device acquires and additional reference
>> for the parent. This keeps the parent device around while the system
>> framebuffer is in use.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Fixes: 9eac534db001 ("firmware/sysfb: Set firmware-framebuffer parent device")
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Javier Martinez Canillas <javierm@redhat.com>
>> Cc: Helge Deller <deller@gmx.de>
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> Cc: Dan Carpenter <dan.carpenter@linaro.org>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Sui Jingfeng <suijingfeng@loongson.cn>
>> Cc: <stable@vger.kernel.org> # v6.9+
>> ---
>>   drivers/firmware/sysfb.c | 13 +++++++++----
>>   1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
>> index 880ffcb50088..dd274563deeb 100644
>> --- a/drivers/firmware/sysfb.c
>> +++ b/drivers/firmware/sysfb.c
>> @@ -101,8 +101,10 @@ static __init struct device *sysfb_parent_dev(const struct screen_info *si)
>>          if (IS_ERR(pdev)) {
>>                  return ERR_CAST(pdev);
>>          } else if (pdev) {
>> -               if (!sysfb_pci_dev_is_enabled(pdev))
>> +               if (!sysfb_pci_dev_is_enabled(pdev)) {
>> +                       pci_dev_put(pdev);
>>                          return ERR_PTR(-ENODEV);
>> +               }
>>                  return &pdev->dev;
>>          }
>>
>> @@ -137,7 +139,7 @@ static __init int sysfb_init(void)
>>          if (compatible) {
>>                  pd = sysfb_create_simplefb(si, &mode, parent);
>>                  if (!IS_ERR(pd))
>> -                       goto unlock_mutex;
>> +                       goto put_device;
>>          }
>>
>>          /* if the FB is incompatible, create a legacy framebuffer device */
>> @@ -155,7 +157,7 @@ static __init int sysfb_init(void)
>>          pd = platform_device_alloc(name, 0);
>>          if (!pd) {
>>                  ret = -ENOMEM;
>> -               goto unlock_mutex;
>> +               goto put_device;
>>          }
>>
>>          pd->dev.parent = parent;
>> @@ -170,9 +172,12 @@ static __init int sysfb_init(void)
>>          if (ret)
>>                  goto err;
>>
>> -       goto unlock_mutex;
>> +
>> +       goto put_device;
>>   err:
>>          platform_device_put(pd);
>> +put_device:
>> +       put_device(parent);
>>   unlock_mutex:
>>          mutex_unlock(&disable_lock);
>>          return ret;
>> --
>> 2.45.2
>>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


      reply	other threads:[~2024-07-02  7:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25  8:17 [PATCH] firmware: sysfb: Fix reference count of sysfb parent device Thomas Zimmermann
2024-06-26 14:47 ` Javier Martinez Canillas
2024-06-28 18:54 ` Marek Olšák
2024-07-02  7:17   ` Thomas Zimmermann [this message]

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=aa9410e7-1ad8-49f4-a31e-59e7d9543421@suse.de \
    --to=tzimmermann@suse.de \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@linaro.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=javierm@redhat.com \
    --cc=maraeo@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=suijingfeng@loongson.cn \
    /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