* [PATCH] fbdev/ffb: fix corrupted video output on FFB1
From: René Rebe @ 2026-02-05 15:49 UTC (permalink / raw)
To: Helge Deller; +Cc: linux-fbdev
Fix Sun FFB1 corrupted video out [1] by disabling overlay and
initializing window mode to a known state. The issue never appeared on
my FFB2+/vertical nor Elite3D/M6. It could also depend on the PROM
version.
/SUNW,ffb@1e,0: FFB at 000001fc00000000, type 11, DAC pnum[236c] rev[10] manuf_rev[4]
X (II) /dev/fb0: Detected FFB1, Z-buffer, Single-buffered.
X (II) /dev/fb0: BT9068 (PAC1) ramdac detected (with normal cursor control)
X (II) /dev/fb0: Detected Creator/Creator3D
[1] https://www.instagram.com/p/DUTcSmSjSem/
Signed-off-by: René Rebe <rene@exactco.de>
Cc: stable@kernel.org
---
Tested on Sun Ultra 2 w/ FFB1 BT9068 (PAC1) ramdac running T2/Linux.
Defines re-used from xf86-video-sunffb.
---
diff --git a/drivers/video/fbdev/ffb.c b/drivers/video/fbdev/ffb.c
index 34b6abff9493..8d77f102dd82 100644
--- a/drivers/video/fbdev/ffb.c
+++ b/drivers/video/fbdev/ffb.c
@@ -335,6 +335,9 @@ struct ffb_dac {
};
#define FFB_DAC_UCTRL 0x1001 /* User Control */
+#define FFB_DAC_UCTRL_OVENAB 0x00000008 /* Overlay Enable */
+#define FFB_DAC_UCTRL_WMODE 0x00000030 /* Window Mode */
+#define FFB_DAC_UCTRL_WM_COMB 0x00000000 /* Window Mode = Combined */
#define FFB_DAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */
#define FFB_DAC_UCTRL_MANREV_SHIFT 8
#define FFB_DAC_TGEN 0x6000 /* Timing Generator */
@@ -425,7 +428,7 @@ static void ffb_switch_from_graph(struct ffb_par *par)
{
struct ffb_fbc __iomem *fbc = par->fbc;
struct ffb_dac __iomem *dac = par->dac;
- unsigned long flags;
+ unsigned long flags, uctrl;
spin_lock_irqsave(&par->lock, flags);
FFBWait(par);
@@ -442,7 +445,7 @@ static void ffb_switch_from_graph(struct ffb_par *par)
upa_writel(par->bg_cache, &fbc->bg);
FFBWait(par);
- /* Disable cursor. */
+ /* Disable cursor. */
upa_writel(FFB_DAC_CUR_CTRL, &dac->type2);
if (par->flags & FFB_FLAG_INVCURSOR)
upa_writel(0, &dac->value2);
@@ -450,6 +453,15 @@ static void ffb_switch_from_graph(struct ffb_par *par)
upa_writel((FFB_DAC_CUR_CTRL_P0 |
FFB_DAC_CUR_CTRL_P1), &dac->value2);
+ /* Disable overlay and window modes. */
+ upa_writel(FFB_DAC_UCTRL, &dac->type);
+ uctrl = upa_readl(&dac->value);
+ uctrl &= ~FFB_DAC_UCTRL_WMODE;
+ uctrl |= FFB_DAC_UCTRL_WM_COMB;
+ uctrl &= ~FFB_DAC_UCTRL_OVENAB;
+ upa_writel(FFB_DAC_UCTRL, &dac->type);
+ upa_writel(uctrl, &dac->value);
+
spin_unlock_irqrestore(&par->lock, flags);
}
--
René Rebe, ExactCODE GmbH, Berlin, Germany
https://exactco.de • https://t2linux.com • https://patreon.com/renerebe
^ permalink raw reply related
* Re: [PATCH RFC v6 03/26] rust: gpu: Add GPU buddy allocator bindings
From: Joel Fernandes @ 2026-02-05 1:00 UTC (permalink / raw)
To: Dave Airlie
Cc: linux-kernel, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Simona Vetter, Jonathan Corbet, Alex Deucher,
Christian König, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
Tvrtko Ursulin, Huang Rui, Matthew Auld, Matthew Brost,
Lucas De Marchi, Thomas Hellström, Helge Deller,
Danilo Krummrich, Alice Ryhl, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Trevor Gross, John Hubbard, Alistair Popple,
Timur Tabi, Edwin Peer, Alexandre Courbot, Andrea Righi,
Andy Ritger, Zhi Wang, Alexey Ivanov, Balbir Singh,
Philipp Stanner, Elle Rhumsaa, Daniel Almeida, joel, nouveau,
dri-devel, rust-for-linux, linux-doc, amd-gfx, intel-gfx,
intel-xe, linux-fbdev
In-Reply-To: <CAPM=9tyL_Cq3+qWc4A41p7eqnNDLS1APUEeUbaQyJ46YDkipVw@mail.gmail.com>
On 2/3/2026 10:55 PM, Dave Airlie wrote:
>> +///
>> +/// These flags control the allocation behavior of the buddy allocator.
>> +#[derive(Clone, Copy, Default, PartialEq, Eq)]
>> +pub struct BuddyFlags(usize);
>> +
>> +impl BuddyFlags {
>> + /// Range-based allocation from start to end addresses.
>> + pub const RANGE_ALLOCATION: usize = bindings::GPU_BUDDY_RANGE_ALLOCATION;
>> +
>> + /// Allocate from top of address space downward.
>> + pub const TOPDOWN_ALLOCATION: usize = bindings::GPU_BUDDY_TOPDOWN_ALLOCATION;
>> +
>> + /// Allocate physically contiguous blocks.
>> + pub const CONTIGUOUS_ALLOCATION: usize = bindings::GPU_BUDDY_CONTIGUOUS_ALLOCATION;
>> +
>> + /// Request allocation from the cleared (zeroed) memory. The zero'ing is not
>> + /// done by the allocator, but by the caller before freeing old blocks.
>> + pub const CLEAR_ALLOCATION: usize = bindings::GPU_BUDDY_CLEAR_ALLOCATION;
>> +
>> + /// Disable trimming of partially used blocks.
>> + pub const TRIM_DISABLE: usize = bindings::GPU_BUDDY_TRIM_DISABLE;
>> +
>> + /// Mark blocks as cleared (zeroed) when freeing. When set during free,
>> + /// indicates that the caller has already zeroed the memory.
>> + pub const CLEARED: usize = bindings::GPU_BUDDY_CLEARED;
>> +
>> + /// Create [`BuddyFlags`] from a raw value with validation.
>> + ///
>> + /// Use `|` operator to combine flags if needed, before calling this method.
>> + pub fn try_new(flags: usize) -> Result<Self> {
>> + // Flags must not exceed u32::MAX to satisfy the GPU buddy allocator C API.
>> + if flags > u32::MAX as usize {
>> + return Err(EINVAL);
>> + }
>> +
>> + // `TOPDOWN_ALLOCATION` only works without `RANGE_ALLOCATION`. When both are
>> + // set, `TOPDOWN_ALLOCATION` is silently ignored by the allocator. Reject this.
>> + if (flags & Self::RANGE_ALLOCATION) != 0 && (flags & Self::TOPDOWN_ALLOCATION) != 0 {
>> + return Err(EINVAL);
>> + }
>> +
>> + Ok(Self(flags))
>> + }
>> +
>> + /// Get raw value of the flags.
>> + pub(crate) fn as_raw(self) -> usize {
>> + self.0
>> + }
>> +}
>> +
>> +/// Parameters for creating a GPU buddy allocator.
>> +#[derive(Clone, Copy)]
>> +pub struct GpuBuddyParams {
>> + /// Base offset in bytes where the managed memory region starts.
>> + /// Allocations will be offset by this value.
>> + pub base_offset_bytes: u64,
>> + /// Total physical memory size managed by the allocator in bytes.
>> + pub physical_memory_size_bytes: u64,
>> + /// Minimum allocation unit / chunk size in bytes, must be >= 4KB.
>> + pub chunk_size_bytes: u64,
>> +}
>> +
>> +/// Parameters for allocating blocks from a GPU buddy allocator.
>> +#[derive(Clone, Copy)]
>> +pub struct GpuBuddyAllocParams {
>> + /// Start of allocation range in bytes. Use 0 for beginning.
>> + pub start_range_address: u64,
>> + /// End of allocation range in bytes. Use 0 for entire range.
>> + pub end_range_address: u64,
>> + /// Total size to allocate in bytes.
>> + pub size_bytes: u64,
>> + /// Minimum block size for fragmented allocations in bytes.
>> + pub min_block_size_bytes: u64,
>> + /// Buddy allocator behavior flags.
>> + pub buddy_flags: BuddyFlags,
>> +}
>> +
>
> (not a full review)
>
> Any reason these two need Clone, Copy? I'm not seeing a use case for
> that, maybe we should pass them as non-mutable references, but I don't
> think there is any point in passing them by value ever.
Yes, one reason I did that is because the doctests reuse the same params. But I
could also just pass by reference as you suggest. It might remove some mem
copies in the doctests. I will make this change then, thanks!
--
Joel Fernandes
^ permalink raw reply
* Re: [PATCH RFC v6 05/26] nova-core: mm: Add support to use PRAMIN windows to write to VRAM
From: Joel Fernandes @ 2026-02-04 23:42 UTC (permalink / raw)
To: Christian König, Dave Airlie
Cc: John Hubbard, Danilo Krummrich, Zhi Wang, linux-kernel,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
Simona Vetter, Jonathan Corbet, Alex Deucher, Jani Nikula,
Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, Rui Huang,
Matthew Auld, Matthew Brost, Lucas De Marchi, Thomas Hellstrom,
Helge Deller, Alice Ryhl, Miguel Ojeda, Alex Gaynor, Boqun Feng,
Gary Guo, Bjorn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Alistair Popple, Timur Tabi, Edwin Peer,
Alexandre Courbot, Andrea Righi, Andy Ritger, Alexey Ivanov,
Balbir Singh, Philipp Stanner, Elle Rhumsaa, Daniel Almeida,
nouveau, dri-devel, rust-for-linux, linux-doc, amd-gfx, intel-gfx,
intel-xe, linux-fbdev
In-Reply-To: <a50c9e31-a182-4ed7-837c-4a12d220c022@amd.com>
On 2/2/2026 4:12 AM, Christian König wrote:
> On 1/31/26 04:00, Dave Airlie wrote:
>> On Sat, 31 Jan 2026 at 07:14, Joel Fernandes <joelagnelf@nvidia.com> wrote:
>>> On 1/29/2026 10:38 PM, John Hubbard wrote:
[...]
>>>> For the deadlock above, I think a good way to break that deadlock is
>>>> to not allow taking that lock in a fence signaling calling path.
>>>>
>>>> So during an unmap, instead of "lock, unmap/free, unlock" it should
>>>> move the item to a deferred-free list, which is processed separately.
>>>> Of course, this is a little complex, because the allocation and reclaim
>>>> has to be aware of such lists if they get large.
>>> Yes, also avoiding GFP_KERNEL allocations while holding any of these mm locks
>>> (whichever we take during map). The GPU buddy actually does GFP_KERNEL
>>> allocations internally which is problematic.
>>>
>>> Some solutions / next steps:
>>>
>>> 1. allocating (VRAM and system memory) outside mm locks just before acquiring them.
>>>
>>> 2. pre-allocating both VRAM and system memory needed, before the DMA fence
>>> critical paths (The issue is also to figure out how much memory to pre-allocate
>>> for the page table pages based on the VM_BIND request. I think we can analyze
>>> the page tables in the submit stage to make an estimate).
>>>
>>> 3. Unfortunately, I am using gpu-buddy when allocating a VA range in the Vmm
>>> (called virt_buddy), which itself does GFP_KERNEL memory allocations in the
>>> allocate path. I am not sure what do yet about this. ISTR the maple tree also
>>> has similar issues.
>>>
>>> 4. Using non-reclaimable memory allocations where pre-allocation or
>>> pre-allocated memory pools is not possible (I'd like to avoid this #4 so we
>>> don't fail allocations when memory is scarce).
>>>
>>> Will work on these issues for the v7. Thanks,
>>
>> The way this works on nouveau at least (and I haven't yet read the
>> nova code in depth).
>>
>> Is we have 4 stages of vmm page table mgmt.
>>
>> ref - locked with a ref lock - can allocate/free memory - just makes
>> sure the page tables exist and are reference counted
>> map - locked with a map lock - cannot allocate memory - fill in the
>> PTEs in the page table
>> unmap - locked with a map lock - cannot allocate memory - removes
>> entries in PTEs
>> unref - locked with a ref lock - can allocate/free memory - just drops
>> references and frees (not sure if it ever merges).
>
> On amdgpu VM page tables are allocated and PTEs filled outside of the fence critical path.
Does that really work for async VM_BIND? If we're missing anything in nova-core
related to the timing of when the allocate and update of the page tables, it
would be good to know.
My understanding you have to write the PTEs at the run stage of the job in
question otherwise you may not know how to map? Are you saying amdgpu writes it
during the run stage but somehow before fence signaling?
>
> Only invalidating PTEs to signal that a shader needs to be taken off the HW are inside the fence critical path and here no memory allocation is needed.
>
> Keep in mind that you not only need to avoid having memory allocations inside the critical path, but also not take locks under which memory is allocated.
Yes, this part I was clear from Danilo's email and clear about the various
deadlocks. See my analysis where what you mention is in the cases I covered:
https://lore.kernel.org/all/20e04a3e-8d7d-47bc-9299-deadf8b9e992@nvidia.com/
> Simona added some dma_fence_begin_signalling() and dma_fence_end_signalling() helpers to add lockdep annotations to the fence signaling path. Those have proven to be extremely useful since they allow lockdep to point out mistakes immediately and not just after hours of running on a test system.
>
Yeah, I looked. Nice! Thanks,
--
Joel Fernandes
^ permalink raw reply
* Re: [PATCH] staging: sm750fb: fix CamelCase warning for dBase
From: Greg KH @ 2026-02-04 15:54 UTC (permalink / raw)
To: Sarah Schwartz
Cc: sudipm.mukherjee, teddy.wang, linux-fbdev, linux-staging,
linux-kernel
In-Reply-To: <20260204153856.23277-1-sarah.schwartz025@gmail.com>
On Wed, Feb 04, 2026 at 03:38:56PM +0000, Sarah Schwartz wrote:
> Rename variable dBase to d_base to fix a CamelCase warning reported by checkpath.pl
> This aligns the code with the Linux kernel coding style.
>
> Signed-off-by: Sarah Schwartz <sarah.schwartz025@gmail.com>
> ---
> drivers/staging/sm750fb/sm750_accel.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
> index 046b9282b..c77b0fe3b 100644
> --- a/drivers/staging/sm750fb/sm750_accel.c
> +++ b/drivers/staging/sm750fb/sm750_accel.c
> @@ -136,7 +136,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
> * @sPitch: Pitch value of source surface in BYTE
> * @sx: Starting x coordinate of source surface
> * @sy: Starting y coordinate of source surface
> - * @dBase: Address of destination: offset in frame buffer
> + * @d_base: Address of destination: offset in frame buffer
what does the "d_" stand for here?
Should that be dest_base instead?
> * @dPitch: Pitch value of destination surface in BYTE
Why ignore all of these other variables as well?
thanks,
greg k-h
^ permalink raw reply
* [PATCH] staging: sm750fb: fix CamelCase warning for dBase
From: Sarah Schwartz @ 2026-02-04 15:38 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, linux-staging, linux-kernel, Sarah Schwartz
Rename variable dBase to d_base to fix a CamelCase warning reported by checkpath.pl
This aligns the code with the Linux kernel coding style.
Signed-off-by: Sarah Schwartz <sarah.schwartz025@gmail.com>
---
drivers/staging/sm750fb/sm750_accel.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 046b9282b..c77b0fe3b 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -136,7 +136,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
* @sPitch: Pitch value of source surface in BYTE
* @sx: Starting x coordinate of source surface
* @sy: Starting y coordinate of source surface
- * @dBase: Address of destination: offset in frame buffer
+ * @d_base: Address of destination: offset in frame buffer
* @dPitch: Pitch value of destination surface in BYTE
* @Bpp: Color depth of destination surface
* @dx: Starting x coordinate of destination surface
@@ -148,7 +148,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
int sm750_hw_copyarea(struct lynx_accel *accel,
unsigned int sBase, unsigned int sPitch,
unsigned int sx, unsigned int sy,
- unsigned int dBase, unsigned int dPitch,
+ unsigned int d_base, unsigned int dPitch,
unsigned int Bpp, unsigned int dx, unsigned int dy,
unsigned int width, unsigned int height,
unsigned int rop2)
@@ -160,7 +160,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
de_ctrl = 0;
/* If source and destination are the same surface, need to check for overlay cases */
- if (sBase == dBase && sPitch == dPitch) {
+ if (sBase == d_base && sPitch == dPitch) {
/* Determine direction of operation */
if (sy < dy) {
/* +----------+
@@ -241,7 +241,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* It is an address offset (128 bit aligned)
* from the beginning of frame buffer.
*/
- write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */
+ write_dpr(accel, DE_WINDOW_DESTINATION_BASE, d_base); /* dpr44 */
/*
* Program pitch (distance between the 1st points of two adjacent lines).
@@ -304,7 +304,7 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)
* and -ive mean button up
* @startBit: Mono data can start at any bit in a byte, this value should be
* 0 to 7
- * @dBase: Address of destination: offset in frame buffer
+ * @d_base: Address of destination: offset in frame buffer
* @dPitch: Pitch value of destination surface in BYTE
* @bytePerPixel: Color depth of destination surface
* @dx: Starting x coordinate of destination surface
@@ -316,7 +316,7 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)
* @rop2: ROP value
*/
int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
- u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch,
+ u32 srcDelta, u32 startBit, u32 d_base, u32 dPitch,
u32 bytePerPixel, u32 dx, u32 dy, u32 width,
u32 height, u32 fColor, u32 bColor, u32 rop2)
{
@@ -345,7 +345,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
* It is an address offset (128 bit aligned)
* from the beginning of frame buffer.
*/
- write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase);
+ write_dpr(accel, DE_WINDOW_DESTINATION_BASE, d_base);
/*
* Program pitch (distance between the 1st points of two adjacent
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v1 2/3] fbdev: au1100fb: Make driver compilable on non-mips platforms
From: kernel test robot @ 2026-02-04 15:16 UTC (permalink / raw)
To: Uwe Kleine-König, Helge Deller
Cc: oe-kbuild-all, Chen Ni, linux-fbdev, dri-devel
In-Reply-To: <474eca0c9ecb8a2e610e82922ad22ad7e8ff0b8b.1770196161.git.u.kleine-koenig@baylibre.com>
Hi Uwe,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 0636e6205beed850d985276dc56fd73d785bea5c]
url: https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/fbdev-au1100fb-Mark-several-local-functions-as-static/20260204-171704
base: 0636e6205beed850d985276dc56fd73d785bea5c
patch link: https://lore.kernel.org/r/474eca0c9ecb8a2e610e82922ad22ad7e8ff0b8b.1770196161.git.u.kleine-koenig%40baylibre.com
patch subject: [PATCH v1 2/3] fbdev: au1100fb: Make driver compilable on non-mips platforms
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20260204/202602042342.RXu7sDV7-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/202602042342.RXu7sDV7-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602042342.RXu7sDV7-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/video/fbdev/au1100fb.c: In function 'au1100fb_fb_mmap':
drivers/video/fbdev/au1100fb.c:354:39: error: lvalue required as left operand of assignment
354 | pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6
| ^~
In file included from include/asm-generic/bug.h:31,
from arch/s390/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from arch/s390/include/asm/cmpxchg.h:11,
from arch/s390/include/asm/atomic.h:16,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/atomic.h:5,
from arch/s390/include/asm/bitops.h:75,
from include/linux/bitops.h:67,
from include/linux/kernel.h:23,
from include/linux/clk.h:13,
from drivers/video/fbdev/au1100fb.c:44:
drivers/video/fbdev/au1100fb.c: In function 'au1100fb_drv_probe':
>> include/linux/kern_levels.h:5:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/printk.h:484:25: note: in definition of macro 'printk_index_wrap'
484 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
drivers/video/fbdev/au1100fb.h:33:30: note: in expansion of macro 'printk'
33 | #define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
| ^~~~~~
include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
| ^~~~~~~~
drivers/video/fbdev/au1100fb.h:33:37: note: in expansion of macro 'KERN_ERR'
33 | #define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
| ^~~~~~~~
drivers/video/fbdev/au1100fb.c:472:17: note: in expansion of macro 'print_err'
472 | print_err("fail to allocate framebuffer (size: %dK))",
| ^~~~~~~~~
vim +5 include/linux/kern_levels.h
314ba3520e513a Joe Perches 2012-07-30 4
04d2c8c83d0e3a Joe Perches 2012-07-30 @5 #define KERN_SOH "\001" /* ASCII Start Of Header */
04d2c8c83d0e3a Joe Perches 2012-07-30 6 #define KERN_SOH_ASCII '\001'
04d2c8c83d0e3a Joe Perches 2012-07-30 7
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* [PATCH 5.10 117/161] fbcon: always restore the old font data in fbcon_do_set_font()
From: Greg Kroah-Hartman @ 2026-02-04 14:39 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiri Slaby (SUSE), Ubisectech Sirius,
Daniel Vetter, Helge Deller, linux-fbdev, dri-devel,
Daniel Vetter
In-Reply-To: <20260204143851.755002596@linuxfoundation.org>
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby (SUSE) <jirislaby@kernel.org>
commit 00d6a284fcf3fad1b7e1b5bc3cd87cbfb60ce03f upstream.
Commit a5a923038d70 (fbdev: fbcon: Properly revert changes when
vc_resize() failed) started restoring old font data upon failure (of
vc_resize()). But it performs so only for user fonts. It means that the
"system"/internal fonts are not restored at all. So in result, the very
first call to fbcon_do_set_font() performs no restore at all upon
failing vc_resize().
This can be reproduced by Syzkaller to crash the system on the next
invocation of font_get(). It's rather hard to hit the allocation failure
in vc_resize() on the first font_set(), but not impossible. Esp. if
fault injection is used to aid the execution/failure. It was
demonstrated by Sirius:
BUG: unable to handle page fault for address: fffffffffffffff8
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD cb7b067 P4D cb7b067 PUD cb7d067 PMD 0
Oops: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 8007 Comm: poc Not tainted 6.7.0-g9d1694dc91ce #20
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:fbcon_get_font+0x229/0x800 drivers/video/fbdev/core/fbcon.c:2286
Call Trace:
<TASK>
con_font_get drivers/tty/vt/vt.c:4558 [inline]
con_font_op+0x1fc/0xf20 drivers/tty/vt/vt.c:4673
vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
vt_ioctl+0x632/0x2ec0 drivers/tty/vt/vt_ioctl.c:752
tty_ioctl+0x6f8/0x1570 drivers/tty/tty_io.c:2803
vfs_ioctl fs/ioctl.c:51 [inline]
...
So restore the font data in any case, not only for user fonts. Note the
later 'if' is now protected by 'old_userfont' and not 'old_data' as the
latter is always set now. (And it is supposed to be non-NULL. Otherwise
we would see the bug above again.)
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Fixes: a5a923038d70 ("fbdev: fbcon: Properly revert changes when vc_resize() failed")
Reported-and-tested-by: Ubisectech Sirius <bugreport@ubisectech.com>
Cc: Ubisectech Sirius <bugreport@ubisectech.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20240208114411.14604-1-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/core/fbcon.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2425,11 +2425,9 @@ static int fbcon_do_set_font(struct vc_d
struct fbcon_ops *ops = info->fbcon_par;
struct fbcon_display *p = &fb_display[vc->vc_num];
int resize, ret, old_userfont, old_width, old_height, old_charcount;
- char *old_data = NULL;
+ u8 *old_data = vc->vc_font.data;
resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
- if (p->userfont)
- old_data = vc->vc_font.data;
vc->vc_font.data = (void *)(p->fontdata = data);
old_userfont = p->userfont;
if ((p->userfont = userfont))
@@ -2463,13 +2461,13 @@ static int fbcon_do_set_font(struct vc_d
update_screen(vc);
}
- if (old_data && (--REFCOUNT(old_data) == 0))
+ if (old_userfont && (--REFCOUNT(old_data) == 0))
kfree(old_data - FONT_EXTRA_WORDS * sizeof(int));
return 0;
err_out:
p->fontdata = old_data;
- vc->vc_font.data = (void *)old_data;
+ vc->vc_font.data = old_data;
if (userfont) {
p->userfont = old_userfont;
^ permalink raw reply
* Re: [PATCH v1 2/3] fbdev: au1100fb: Make driver compilable on non-mips platforms
From: kernel test robot @ 2026-02-04 14:34 UTC (permalink / raw)
To: Uwe Kleine-König, Helge Deller
Cc: llvm, oe-kbuild-all, Chen Ni, linux-fbdev, dri-devel
In-Reply-To: <474eca0c9ecb8a2e610e82922ad22ad7e8ff0b8b.1770196161.git.u.kleine-koenig@baylibre.com>
Hi Uwe,
kernel test robot noticed the following build errors:
[auto build test ERROR on 0636e6205beed850d985276dc56fd73d785bea5c]
url: https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/fbdev-au1100fb-Mark-several-local-functions-as-static/20260204-171704
base: 0636e6205beed850d985276dc56fd73d785bea5c
patch link: https://lore.kernel.org/r/474eca0c9ecb8a2e610e82922ad22ad7e8ff0b8b.1770196161.git.u.kleine-koenig%40baylibre.com
patch subject: [PATCH v1 2/3] fbdev: au1100fb: Make driver compilable on non-mips platforms
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260204/202602042224.CY8SSh3n-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/202602042224.CY8SSh3n-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602042224.CY8SSh3n-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/video/fbdev/au1100fb.c:354:32: error: expression is not assignable
354 | pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
drivers/video/fbdev/au1100fb.c:473:6: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
472 | print_err("fail to allocate framebuffer (size: %dK))",
| ~~
| %zu
473 | fbdev->fb_len / 1024);
| ^~~~~~~~~~~~~~~~~~~~
drivers/video/fbdev/au1100fb.h:33:74: note: expanded from macro 'print_err'
33 | #define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
| ~ ^~~
include/linux/printk.h:512:60: note: expanded from macro 'printk'
512 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/printk.h:484:19: note: expanded from macro 'printk_index_wrap'
484 | _p_func(_fmt, ##__VA_ARGS__); \
| ~~~~ ^~~~~~~~~~~
1 warning and 1 error generated.
vim +354 drivers/video/fbdev/au1100fb.c
3b495f2bb749b82 drivers/video/au1100fb.c Pete Popov 2005-04-04 343
3b495f2bb749b82 drivers/video/au1100fb.c Pete Popov 2005-04-04 344 /* fb_mmap
3b495f2bb749b82 drivers/video/au1100fb.c Pete Popov 2005-04-04 345 * Map video memory in user space. We don't use the generic fb_mmap method mainly
3b495f2bb749b82 drivers/video/au1100fb.c Pete Popov 2005-04-04 346 * to allow the use of the TLB streaming flag (CCA=6)
3b495f2bb749b82 drivers/video/au1100fb.c Pete Popov 2005-04-04 347 */
0238b447706a72c drivers/video/fbdev/au1100fb.c Uwe Kleine-König 2026-02-04 348 static int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
3b495f2bb749b82 drivers/video/au1100fb.c Pete Popov 2005-04-04 349 {
67f30ad19c4b329 drivers/video/fbdev/au1100fb.c Christoph Hellwig 2019-04-28 350 struct au1100fb_device *fbdev = to_au1100fb_device(fbi);
c05b7f3d12b9455 drivers/video/au1100fb.c Rodolfo Giometti 2006-05-30 351
76f92201b821dd2 drivers/video/fbdev/au1100fb.c Thomas Zimmermann 2023-11-27 352 vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
76f92201b821dd2 drivers/video/fbdev/au1100fb.c Thomas Zimmermann 2023-11-27 353
^1da177e4c3f415 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 @354 pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6
^1da177e4c3f415 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 355
67f30ad19c4b329 drivers/video/fbdev/au1100fb.c Christoph Hellwig 2019-04-28 356 return dma_mmap_coherent(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys,
67f30ad19c4b329 drivers/video/fbdev/au1100fb.c Christoph Hellwig 2019-04-28 357 fbdev->fb_len);
^1da177e4c3f415 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 358 }
^1da177e4c3f415 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 359
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH v1 2/3] fbdev: au1100fb: Make driver compilable on non-mips platforms
From: kernel test robot @ 2026-02-04 14:13 UTC (permalink / raw)
To: Uwe Kleine-König, Helge Deller
Cc: llvm, oe-kbuild-all, Chen Ni, linux-fbdev, dri-devel
In-Reply-To: <474eca0c9ecb8a2e610e82922ad22ad7e8ff0b8b.1770196161.git.u.kleine-koenig@baylibre.com>
Hi Uwe,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 0636e6205beed850d985276dc56fd73d785bea5c]
url: https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/fbdev-au1100fb-Mark-several-local-functions-as-static/20260204-171704
base: 0636e6205beed850d985276dc56fd73d785bea5c
patch link: https://lore.kernel.org/r/474eca0c9ecb8a2e610e82922ad22ad7e8ff0b8b.1770196161.git.u.kleine-koenig%40baylibre.com
patch subject: [PATCH v1 2/3] fbdev: au1100fb: Make driver compilable on non-mips platforms
config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260204/202602042233.GXk79AnA-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260204/202602042233.GXk79AnA-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602042233.GXk79AnA-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/video/fbdev/au1100fb.c:473:6: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
472 | print_err("fail to allocate framebuffer (size: %dK))",
| ~~
| %zu
473 | fbdev->fb_len / 1024);
| ^~~~~~~~~~~~~~~~~~~~
drivers/video/fbdev/au1100fb.h:33:74: note: expanded from macro 'print_err'
33 | #define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
| ~ ^~~
include/linux/printk.h:512:60: note: expanded from macro 'printk'
512 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/printk.h:484:19: note: expanded from macro 'printk_index_wrap'
484 | _p_func(_fmt, ##__VA_ARGS__); \
| ~~~~ ^~~~~~~~~~~
1 warning generated.
vim +473 drivers/video/fbdev/au1100fb.c
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 415
48c68c4f1b5424 drivers/video/au1100fb.c Greg Kroah-Hartman 2012-12-21 416 static int au1100fb_drv_probe(struct platform_device *dev)
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 417 {
46953e6aab262d drivers/video/fbdev/au1100fb.c Markus Elfring 2018-03-28 418 struct au1100fb_device *fbdev;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 419 struct resource *regs_res;
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 420 struct clk *c;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 421
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 422 /* Allocate new device private */
db66f0252e2f17 drivers/video/fbdev/au1100fb.c Markus Elfring 2018-03-28 423 fbdev = devm_kzalloc(&dev->dev, sizeof(*fbdev), GFP_KERNEL);
29914badc59b23 drivers/video/fbdev/au1100fb.c Markus Elfring 2018-03-28 424 if (!fbdev)
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 425 return -ENOMEM;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 426
d121c3f3cedb84 drivers/video/au1100fb.c Manuel Lauss 2011-09-30 427 if (au1100fb_setup(fbdev))
d121c3f3cedb84 drivers/video/au1100fb.c Manuel Lauss 2011-09-30 428 goto failed;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 429
7a192ec334cab9 drivers/video/au1100fb.c Ming Lei 2009-02-06 430 platform_set_drvdata(dev, (void *)fbdev);
67f30ad19c4b32 drivers/video/fbdev/au1100fb.c Christoph Hellwig 2019-04-28 431 fbdev->dev = &dev->dev;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 432
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 433 /* Allocate region for our registers and map them */
d121c3f3cedb84 drivers/video/au1100fb.c Manuel Lauss 2011-09-30 434 regs_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
d121c3f3cedb84 drivers/video/au1100fb.c Manuel Lauss 2011-09-30 435 if (!regs_res) {
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 436 print_err("fail to retrieve registers resource");
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 437 return -EFAULT;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 438 }
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 439
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 440 au1100fb_fix.mmio_start = regs_res->start;
28f65c11f2ffb3 drivers/video/au1100fb.c Joe Perches 2011-06-09 441 au1100fb_fix.mmio_len = resource_size(regs_res);
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 442
93019734555f8d drivers/video/au1100fb.c Manuel Lauss 2012-03-24 443 if (!devm_request_mem_region(&dev->dev,
93019734555f8d drivers/video/au1100fb.c Manuel Lauss 2012-03-24 444 au1100fb_fix.mmio_start,
1c16697bf9d5b2 drivers/video/au1100fb.c Julia Lawall 2012-01-21 445 au1100fb_fix.mmio_len,
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 446 DRIVER_NAME)) {
c05b7f3d12b945 drivers/video/au1100fb.c Rodolfo Giometti 2006-05-30 447 print_err("fail to lock memory region at 0x%08lx",
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 448 au1100fb_fix.mmio_start);
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 449 return -EBUSY;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 450 }
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 451
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 452 fbdev->regs = (struct au1100fb_regs*)KSEG1ADDR(au1100fb_fix.mmio_start);
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 453
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 454 print_dbg("Register memory map at %p", fbdev->regs);
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 455 print_dbg("phys=0x%08x, size=%d", fbdev->regs_phys, fbdev->regs_len);
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 456
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 457 c = clk_get(NULL, "lcd_intclk");
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 458 if (!IS_ERR(c)) {
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 459 fbdev->lcdclk = c;
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 460 clk_set_rate(c, 48000000);
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 461 clk_prepare_enable(c);
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 462 }
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 463
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 464 /* Allocate the framebuffer to the maximum screen size * nbr of video buffers */
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 465 fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres *
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 466 (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 467
93019734555f8d drivers/video/au1100fb.c Manuel Lauss 2012-03-24 468 fbdev->fb_mem = dmam_alloc_coherent(&dev->dev,
1c16697bf9d5b2 drivers/video/au1100fb.c Julia Lawall 2012-01-21 469 PAGE_ALIGN(fbdev->fb_len),
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 470 &fbdev->fb_phys, GFP_KERNEL);
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 471 if (!fbdev->fb_mem) {
3879490f3a9765 drivers/video/fbdev/au1100fb.c Colin Ian King 2018-05-15 472 print_err("fail to allocate framebuffer (size: %dK))",
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 @473 fbdev->fb_len / 1024);
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 474 return -ENOMEM;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 475 }
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 476
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 477 au1100fb_fix.smem_start = fbdev->fb_phys;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 478 au1100fb_fix.smem_len = fbdev->fb_len;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 479
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 480 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 481 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024);
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 482
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 483 /* load the panel info into the var struct */
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 484 au1100fb_var.bits_per_pixel = fbdev->panel->bpp;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 485 au1100fb_var.xres = fbdev->panel->xres;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 486 au1100fb_var.xres_virtual = au1100fb_var.xres;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 487 au1100fb_var.yres = fbdev->panel->yres;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 488 au1100fb_var.yres_virtual = au1100fb_var.yres;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 489
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 490 fbdev->info.screen_base = fbdev->fb_mem;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 491 fbdev->info.fbops = &au1100fb_ops;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 492 fbdev->info.fix = au1100fb_fix;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 493
1c16697bf9d5b2 drivers/video/au1100fb.c Julia Lawall 2012-01-21 494 fbdev->info.pseudo_palette =
a86854d0c599b3 drivers/video/fbdev/au1100fb.c Kees Cook 2018-06-12 495 devm_kcalloc(&dev->dev, 16, sizeof(u32), GFP_KERNEL);
1c16697bf9d5b2 drivers/video/au1100fb.c Julia Lawall 2012-01-21 496 if (!fbdev->info.pseudo_palette)
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 497 return -ENOMEM;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 498
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 499 if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) {
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 500 print_err("Fail to allocate colormap (%d entries)",
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 501 AU1100_LCD_NBR_PALETTE_ENTRIES);
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 502 return -EFAULT;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 503 }
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 504
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 505 fbdev->info.var = au1100fb_var;
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 506
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 507 /* Set h/w registers */
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 508 au1100fb_setmode(fbdev);
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 509
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 510 /* Register new framebuffer */
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 511 if (register_framebuffer(&fbdev->info) < 0) {
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 512 print_err("cannot register new framebuffer");
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 513 goto failed;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 514 }
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 515
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 516 return 0;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 517
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 518 failed:
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 519 if (fbdev->lcdclk) {
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 520 clk_disable_unprepare(fbdev->lcdclk);
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 521 clk_put(fbdev->lcdclk);
6b1889c14b4606 drivers/video/fbdev/au1100fb.c Manuel Lauss 2014-07-23 522 }
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 523 if (fbdev->info.cmap.len != 0) {
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 524 fb_dealloc_cmap(&fbdev->info.cmap);
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 525 }
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 526
1c16697bf9d5b2 drivers/video/au1100fb.c Julia Lawall 2012-01-21 527 return -ENODEV;
3b495f2bb749b8 drivers/video/au1100fb.c Pete Popov 2005-04-04 528 }
^1da177e4c3f41 drivers/video/au1100fb.c Linus Torvalds 2005-04-16 529
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH] staging: sm750fb: remove unnecessary parentheses in ddk750_swi2c.c
From: Greg Kroah-Hartman @ 2026-02-04 13:14 UTC (permalink / raw)
To: Zeeshan Ahmad
Cc: Sudip Mukherjee, Teddy Wang, linux-staging, linux-fbdev,
linux-kernel
In-Reply-To: <20260204125525.5498-1-zeeshanahmad022019@gmail.com>
On Wed, Feb 04, 2026 at 05:55:25PM +0500, Zeeshan Ahmad wrote:
> Checkpatch reported "Unnecessary parentheses around 'clk_gpio > 31'"
> and 'data_gpio > 31'.
>
> Remove the extra parentheses to clean up the code and satisfy the
> coding style guidelines.
>
> Signed-off-by: Zeeshan Ahmad <zeeshanahmad022019@gmail.com>
> ---
> drivers/staging/sm750fb/ddk750_swi2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
> index 0ef8d4ff2ef9..50e51d730d86 100644
> --- a/drivers/staging/sm750fb/ddk750_swi2c.c
> +++ b/drivers/staging/sm750fb/ddk750_swi2c.c
> @@ -393,7 +393,7 @@ long sm750_sw_i2c_init(unsigned char clk_gpio, unsigned char data_gpio)
> * Return 0 if the GPIO pins to be used is out of range. The
> * range is only from [0..63]
> */
> - if ((clk_gpio > 31) || (data_gpio > 31))
> + if (clk_gpio > 31 || data_gpio > 31)
Now I have to remember which is a higher priority in C, > or ||
Please don't make changes like this, I thought checkpatch turned these
off for staging code, as I keep complaining about it on a weekly (or
more than that) basis :(
If you look at the mailing list, I think I just complained about this a
few hours before you sent this change as well...
thanks,
greg k-h
^ permalink raw reply
* [PATCH] staging: sm750fb: remove unnecessary parentheses in ddk750_swi2c.c
From: Zeeshan Ahmad @ 2026-02-04 12:55 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-staging, linux-fbdev, linux-kernel, Zeeshan Ahmad
Checkpatch reported "Unnecessary parentheses around 'clk_gpio > 31'"
and 'data_gpio > 31'.
Remove the extra parentheses to clean up the code and satisfy the
coding style guidelines.
Signed-off-by: Zeeshan Ahmad <zeeshanahmad022019@gmail.com>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 0ef8d4ff2ef9..50e51d730d86 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -393,7 +393,7 @@ long sm750_sw_i2c_init(unsigned char clk_gpio, unsigned char data_gpio)
* Return 0 if the GPIO pins to be used is out of range. The
* range is only from [0..63]
*/
- if ((clk_gpio > 31) || (data_gpio > 31))
+ if (clk_gpio > 31 || data_gpio > 31)
return -1;
if (sm750_get_chip_type() == SM750LE)
--
2.43.0
^ permalink raw reply related
* [PATCH v3 5/5] staging: sm750fb: convert logging to device-based in sm750_hw.c
From: Artem Lytkin @ 2026-02-04 12:06 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
In-Reply-To: <20260204120602.6715-1-iprintercanon@gmail.com>
Convert pr_err calls to dev_err using &pdev->dev in hw_sm750_map()
where struct pci_dev *pdev is available as a function parameter.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750_hw.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index e3e4b75d6..bf4c1585c 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -42,7 +42,7 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
*/
ret = pci_request_region(pdev, 1, "sm750fb");
if (ret) {
- pr_err("Can not request PCI regions.\n");
+ dev_err(&pdev->dev, "Can not request PCI regions.\n");
goto exit;
}
@@ -50,7 +50,7 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
sm750_dev->pvReg =
ioremap(sm750_dev->vidreg_start, sm750_dev->vidreg_size);
if (!sm750_dev->pvReg) {
- pr_err("mmio failed\n");
+ dev_err(&pdev->dev, "mmio failed\n");
ret = -EFAULT;
goto exit;
}
@@ -75,7 +75,7 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
ioremap_wc(sm750_dev->vidmem_start, sm750_dev->vidmem_size);
if (!sm750_dev->pvMem) {
iounmap(sm750_dev->pvReg);
- pr_err("Map video memory failed\n");
+ dev_err(&pdev->dev, "Map video memory failed\n");
ret = -EFAULT;
goto exit;
}
--
2.43.0
^ permalink raw reply related
* [PATCH v3 4/5] staging: sm750fb: convert logging to device-based in sm750.c
From: Artem Lytkin @ 2026-02-04 12:06 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
In-Reply-To: <20260204120602.6715-1-iprintercanon@gmail.com>
Convert remaining pr_err and pr_warn calls to dev_err and dev_warn
using info->device where struct fb_info is available. This provides
proper device context in log messages.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 050408af2..1561fa5fe 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -388,7 +388,8 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->accel_flags = 0;/*FB_ACCELF_TEXT;*/
if (ret) {
- pr_err("bpp %d not supported\n", var->bits_per_pixel);
+ dev_err(info->device, "bpp %d not supported\n",
+ var->bits_per_pixel);
return ret;
}
ret = hw_sm750_crtc_set_mode(crtc, var, fix);
@@ -487,7 +488,8 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
ret = lynxfb_set_color_offsets(info);
if (ret) {
- pr_err("bpp %d not supported\n", var->bits_per_pixel);
+ dev_err(info->device, "bpp %d not supported\n",
+ var->bits_per_pixel);
return ret;
}
@@ -502,7 +504,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
request = ALIGN(request, crtc->line_pad);
request = request * var->yres_virtual;
if (crtc->vidmem_size < request) {
- pr_err("not enough video memory for mode\n");
+ dev_err(info->device, "not enough video memory for mode\n");
return -ENOMEM;
}
@@ -527,7 +529,7 @@ static int lynxfb_ops_setcolreg(unsigned int regno,
ret = 0;
if (regno > 256) {
- pr_err("regno = %d\n", regno);
+ dev_err(info->device, "regno = %d\n", regno);
return -EINVAL;
}
@@ -793,21 +795,23 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
pdb[i], cdb[i], NULL, 8);
if (ret == 1) {
- pr_info("success! use specified mode:%s in %s\n",
- g_fbmode[index],
- mdb_desc[i]);
+ dev_info(info->device,
+ "use specified mode:%s in %s\n",
+ g_fbmode[index],
+ mdb_desc[i]);
break;
} else if (ret == 2) {
- pr_warn("use specified mode:%s in %s,with an ignored refresh rate\n",
- g_fbmode[index],
- mdb_desc[i]);
+ dev_warn(info->device,
+ "use specified mode:%s in %s, with an ignored refresh rate\n",
+ g_fbmode[index],
+ mdb_desc[i]);
break;
} else if (ret == 3 || ret == 4) {
continue;
} else {
- pr_warn("ret = %d,fb_find_mode failed,with %s\n",
- ret,
- mdb_desc[i]);
+ dev_warn(info->device,
+ "fb_find_mode failed with %s (ret=%d)\n",
+ mdb_desc[i], ret);
}
}
@@ -855,7 +859,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
ret = fb_alloc_cmap(&info->cmap, 256, 0);
if (ret < 0) {
- pr_err("Could not allocate memory for cmap.\n");
+ dev_err(info->device, "Could not allocate memory for cmap.\n");
goto exit;
}
--
2.43.0
^ permalink raw reply related
* [PATCH v3 3/5] staging: sm750fb: remove debug and diagnostic prints
From: Artem Lytkin @ 2026-02-04 12:06 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
In-Reply-To: <20260204120602.6715-1-iprintercanon@gmail.com>
Remove pr_info, pr_debug, and pr_warn calls that dump internal
variable values, pointer addresses, structure contents, and
other diagnostic information not useful for production use.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 53 ++----------------------------
drivers/staging/sm750fb/sm750_hw.c | 8 -----
2 files changed, 2 insertions(+), 59 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index bd2d4a290..050408af2 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -375,7 +375,6 @@ static int lynxfb_ops_set_par(struct fb_info *info)
line_length = var->xres_virtual * var->bits_per_pixel / 8;
line_length = ALIGN(line_length, crtc->line_pad);
fix->line_length = line_length;
- pr_info("fix->line_length = %d\n", fix->line_length);
/*
* var->red,green,blue,transp are need to be set by driver
@@ -485,11 +484,6 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
par = info->par;
crtc = &par->crtc;
- pr_debug("check var:%dx%d-%d\n",
- var->xres,
- var->yres,
- var->bits_per_pixel);
-
ret = lynxfb_set_color_offsets(info);
if (ret) {
@@ -580,7 +574,6 @@ static int lynxfb_ops_blank(int blank, struct fb_info *info)
struct lynxfb_par *par;
struct lynxfb_output *output;
- pr_debug("blank = %d.\n", blank);
par = info->par;
output = &par->output;
sm750_dev = par->dev;
@@ -625,7 +618,6 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->channel = sm750_primary;
crtc->o_screen = 0;
crtc->v_screen = sm750_dev->pvMem;
- pr_info("use simul primary mode\n");
break;
case sm750_simul_sec:
output->paths = sm750_pnc;
@@ -767,7 +759,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
crtc->cursor.mmio = sm750_dev->pvReg +
0x800f0 + (int)crtc->channel * 0x140;
- pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
crtc->cursor.max_h = 64;
crtc->cursor.max_w = 64;
crtc->cursor.size = crtc->cursor.max_h * crtc->cursor.max_w * 2 / 8;
@@ -811,11 +802,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
g_fbmode[index],
mdb_desc[i]);
break;
- } else if (ret == 3) {
- pr_warn("wanna use default mode\n");
- /*break;*/
- } else if (ret == 4) {
- pr_warn("fall back to any valid mode\n");
+ } else if (ret == 3 || ret == 4) {
+ continue;
} else {
pr_warn("ret = %d,fb_find_mode failed,with %s\n",
ret,
@@ -823,25 +811,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
}
}
- /* some member of info->var had been set by fb_find_mode */
-
- pr_info("Member of info->var is :\n"
- "xres=%d\n"
- "yres=%d\n"
- "xres_virtual=%d\n"
- "yres_virtual=%d\n"
- "xoffset=%d\n"
- "yoffset=%d\n"
- "bits_per_pixel=%d\n"
- " ...\n",
- var->xres,
- var->yres,
- var->xres_virtual,
- var->yres_virtual,
- var->xoffset,
- var->yoffset,
- var->bits_per_pixel);
-
/* set par */
par->info = info;
@@ -851,7 +820,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
info->pseudo_palette = &par->pseudo_palette[0];
info->screen_base = crtc->v_screen;
- pr_debug("screen_base vaddr = %p\n", info->screen_base);
info->screen_size = line_length * var->yres_virtual;
/* set info->fix */
@@ -865,7 +833,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
strscpy(fix->id, fixId[index], sizeof(fix->id));
fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start;
- pr_info("fix->smem_start = %lx\n", fix->smem_start);
/*
* according to mmap experiment from user space application,
* fix->mmio_len should not larger than virtual size
@@ -874,13 +841,10 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
* data into the bound over virtual size
*/
fix->smem_len = crtc->vidmem_size;
- pr_info("fix->smem_len = %x\n", fix->smem_len);
info->screen_size = fix->smem_len;
fix->line_length = line_length;
fix->mmio_start = sm750_dev->vidreg_start;
- pr_info("fix->mmio_start = %lx\n", fix->mmio_start);
fix->mmio_len = sm750_dev->vidreg_size;
- pr_info("fix->mmio_len = %x\n", fix->mmio_len);
lynxfb_set_visual_mode(info);
@@ -889,22 +853,12 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
var->accel_flags = 0;
var->vmode = FB_VMODE_NONINTERLACED;
- pr_debug("#1 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
- info->cmap.start, info->cmap.len,
- info->cmap.red, info->cmap.green, info->cmap.blue,
- info->cmap.transp);
-
ret = fb_alloc_cmap(&info->cmap, 256, 0);
if (ret < 0) {
pr_err("Could not allocate memory for cmap.\n");
goto exit;
}
- pr_debug("#2 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
- info->cmap.start, info->cmap.len,
- info->cmap.red, info->cmap.green, info->cmap.blue,
- info->cmap.transp);
-
exit:
lynxfb_ops_check_var(var, info);
return ret;
@@ -934,9 +888,6 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
}
while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
- dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
- dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
-
if (!strcmp(opt, "swap")) {
swap = 1;
} else if (!strcmp(opt, "nocrt")) {
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index ce46f240c..e3e4b75d6 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -34,8 +34,6 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
sm750_dev->vidreg_start = pci_resource_start(pdev, 1);
sm750_dev->vidreg_size = SZ_2M;
- pr_info("mmio phyAddr = %lx\n", sm750_dev->vidreg_start);
-
/*
* reserve the vidreg space of smi adaptor
* if you do this, you need to add release region code
@@ -56,7 +54,6 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
ret = -EFAULT;
goto exit;
}
- pr_info("mmio virtual addr = %p\n", sm750_dev->pvReg);
sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
@@ -72,8 +69,6 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
* @ddk750_get_vm_size function can be safe.
*/
sm750_dev->vidmem_size = ddk750_get_vm_size();
- pr_info("video memory phyAddr = %lx, size = %u bytes\n",
- sm750_dev->vidmem_start, sm750_dev->vidmem_size);
/* reserve the vidmem space of smi adaptor */
sm750_dev->pvMem =
@@ -84,7 +79,6 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
ret = -EFAULT;
goto exit;
}
- pr_info("video memory vaddr = %p\n", sm750_dev->pvMem);
exit:
return ret;
}
@@ -163,11 +157,9 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
* The following register values for CH7301 are from
* Chrontel app note and our experiment.
*/
- pr_info("yes,CH7301 DVI chip found\n");
sm750_sw_i2c_write_reg(0xec, 0x1d, 0x16);
sm750_sw_i2c_write_reg(0xec, 0x21, 0x9);
sm750_sw_i2c_write_reg(0xec, 0x49, 0xC0);
- pr_info("okay,CH7301 DVI chip setup done\n");
}
}
--
2.43.0
^ permalink raw reply related
* [PATCH v3 2/5] staging: sm750fb: use strcmp() for exact option matching
From: Artem Lytkin @ 2026-02-04 12:05 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
In-Reply-To: <20260204120602.6715-1-iprintercanon@gmail.com>
Replace strncmp(opt, "...", strlen("...")) with strcmp() in option
parsing functions. Options from strsep() are complete null-terminated
tokens, so prefix matching via strncmp() could cause false positives
for options like "noaccelXYZ" matching "noaccel".
Fixes: 81dee67e215b ("staging: sm750fb: add sm750 to staging")
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 4c6e84c03..bd2d4a290 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -937,21 +937,21 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
- if (!strncmp(opt, "swap", strlen("swap"))) {
+ if (!strcmp(opt, "swap")) {
swap = 1;
- } else if (!strncmp(opt, "nocrt", strlen("nocrt"))) {
+ } else if (!strcmp(opt, "nocrt")) {
sm750_dev->nocrt = 1;
- } else if (!strncmp(opt, "36bit", strlen("36bit"))) {
+ } else if (!strcmp(opt, "36bit")) {
sm750_dev->pnltype = sm750_doubleTFT;
- } else if (!strncmp(opt, "18bit", strlen("18bit"))) {
+ } else if (!strcmp(opt, "18bit")) {
sm750_dev->pnltype = sm750_dualTFT;
- } else if (!strncmp(opt, "24bit", strlen("24bit"))) {
+ } else if (!strcmp(opt, "24bit")) {
sm750_dev->pnltype = sm750_24TFT;
- } else if (!strncmp(opt, "nohwc0", strlen("nohwc0"))) {
+ } else if (!strcmp(opt, "nohwc0")) {
g_hwcursor &= ~0x1;
- } else if (!strncmp(opt, "nohwc1", strlen("nohwc1"))) {
+ } else if (!strcmp(opt, "nohwc1")) {
g_hwcursor &= ~0x2;
- } else if (!strncmp(opt, "nohwc", strlen("nohwc"))) {
+ } else if (!strcmp(opt, "nohwc")) {
g_hwcursor = 0;
} else {
if (!g_fbmode[0]) {
@@ -1156,11 +1156,11 @@ static int __init lynxfb_setup(char *options)
*/
while ((opt = strsep(&options, ":")) != NULL) {
/* options that mean for any lynx chips are configured here */
- if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
+ if (!strcmp(opt, "noaccel")) {
g_noaccel = 1;
- } else if (!strncmp(opt, "nomtrr", strlen("nomtrr"))) {
+ } else if (!strcmp(opt, "nomtrr")) {
g_nomtrr = 1;
- } else if (!strncmp(opt, "dual", strlen("dual"))) {
+ } else if (!strcmp(opt, "dual")) {
g_dualview = 1;
} else {
memcpy(tmp, opt, strlen(opt));
--
2.43.0
^ permalink raw reply related
* [PATCH v3 1/5] staging: sm750fb: replace strcat() with memcpy() in lynxfb_setup()
From: Artem Lytkin @ 2026-02-04 12:05 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
As part of kernel hardening, I am auditing calls to strcat(). This
code works but it is a bit ugly.
This function takes a string "options" and allocates "g_settings"
which is large enough to hold a copy of "options". It copies all the
options from "options" to "g_settings" except "noaccel", "nomtrr" and
"dual". The new buffer is large enough to fit all the options so
there is no buffer overflow in using strcat() here.
However, using strcat() is misleading because "tmp" always points
to the next unused character in the "g_settings" buffer and it's
always the NUL character. Use memcpy() instead to make the code
easier to read. This also removes an instance of strcat() which
is a #NiceBonus.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index fecd7457e..4c6e84c03 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1163,7 +1163,7 @@ static int __init lynxfb_setup(char *options)
} else if (!strncmp(opt, "dual", strlen("dual"))) {
g_dualview = 1;
} else {
- strcat(tmp, opt);
+ memcpy(tmp, opt, strlen(opt));
tmp += strlen(opt);
if (options)
*tmp++ = ':';
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v2 4/4] staging: sm750fb: remove debug prints and convert logging in sm750_hw.c
From: Dan Carpenter @ 2026-02-04 11:39 UTC (permalink / raw)
To: Artem Lytkin
Cc: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman, linux-fbdev,
linux-staging, linux-kernel
In-Reply-To: <20260204101536.3311-4-iprintercanon@gmail.com>
On Wed, Feb 04, 2026 at 10:15:36AM +0000, Artem Lytkin wrote:
> @@ -163,11 +156,11 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
> * The following register values for CH7301 are from
> * Chrontel app note and our experiment.
> */
> - pr_info("yes,CH7301 DVI chip found\n");
> + dev_info(&pdev->dev, "CH7301 DVI chip found\n");
> sm750_sw_i2c_write_reg(0xec, 0x1d, 0x16);
> sm750_sw_i2c_write_reg(0xec, 0x21, 0x9);
> sm750_sw_i2c_write_reg(0xec, 0x49, 0xC0);
> - pr_info("okay,CH7301 DVI chip setup done\n");
> + dev_info(&pdev->dev, "CH7301 DVI chip setup done\n");
Delete at least one of these. Pretty sure that Greg will want you to
delete both actually.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v2 3/4] staging: sm750fb: remove debug prints and convert logging in sm750.c
From: Dan Carpenter @ 2026-02-04 11:17 UTC (permalink / raw)
To: Artem Lytkin
Cc: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman, linux-fbdev,
linux-staging, linux-kernel
In-Reply-To: <20260204101536.3311-3-iprintercanon@gmail.com>
On Wed, Feb 04, 2026 at 10:15:35AM +0000, Artem Lytkin wrote:
> Remove debug prints disguised as pr_info that dump internal variable
> values, pointer addresses, and structure contents. Convert remaining
> meaningful pr_err and pr_warn calls to dev_err and dev_warn where
> device context is available.
I feel like you should delete things as a separate step. It makes it
slightly easier to think about.
It's really a no brainer to delete all the pr_info() stuff. I don't
really have a problem deleting the debug code as well, but that's a
slightly more involved question because it doesn't really hurt anyone.
I guess no one will complain. Greg tends to be a fan of deleting stuff
as well.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v2 2/4] staging: sm750fb: use strcmp() for exact option matching
From: Dan Carpenter @ 2026-02-04 11:11 UTC (permalink / raw)
To: Artem Lytkin
Cc: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman, linux-fbdev,
linux-staging, linux-kernel
In-Reply-To: <20260204101536.3311-2-iprintercanon@gmail.com>
On Wed, Feb 04, 2026 at 10:15:34AM +0000, Artem Lytkin wrote:
> Replace strncmp(opt, "...", strlen("...")) with strcmp() in option
> parsing functions. Options from strsep() are complete null-terminated
> tokens, so prefix matching via strncmp() could cause false positives
> for options like "noaccelXYZ" matching "noaccel".
>
> Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
> ---
You've changed how the code works and this is a bugfix. It should have
a Fixes tag.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v2 1/4] staging: sm750fb: add bounds checking to option parsing in lynxfb_setup()
From: Dan Carpenter @ 2026-02-04 11:10 UTC (permalink / raw)
To: Artem Lytkin
Cc: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman, linux-fbdev,
linux-staging, linux-kernel
In-Reply-To: <20260204101536.3311-1-iprintercanon@gmail.com>
On Wed, Feb 04, 2026 at 10:15:33AM +0000, Artem Lytkin wrote:
> Replace strcat() with memcpy() and add explicit bounds checking on the
> remaining buffer space before each copy. The original code lacked any
> validation that the write position stays within the allocated buffer.
>
This implies that there is a buffer overflow. It's important to review
this sort of thing and add a Fixes tag if the buffer overflow is real.
In this case the code works ok as-is. My main problem with the
original code is what you explained in the v1 commit, the strcat() was
just doing a memcpy(). It wasn't concatenating two strings.
Just resend the v1 patch with the following commit message:
As part of kernel hardening, I am auditing calls to strcat(). This
code works but it is a bit ugly.
This function takes a string "options" and allocates "g_settings"
which is large enough to hold a copy of "options". It copies all the
options from "options" to "g_settings" except "noaccel", "nomtrr" and
"dual". The new buffer is large enough to fit all the options so
there is no buffer overflow in using strcat() here.
However, using strcat() is misleading because "tmp" always points
to the next unused character in the "g_settings" buffer and it's
always the NUL character. Use memcpy() instead to make the code
easier to read. This also removes an instance of strcat() which
is a #NiceBonus.
regards,
dan carpenter
^ permalink raw reply
* Re: (subset) [PATCH v6 2/2] mfd: cgbc: Add support for backlight
From: Lee Jones @ 2026-02-04 11:02 UTC (permalink / raw)
To: Thomas Richard, Lee Jones, Daniel Thompson, Jingoo Han,
Helge Deller, Petri Karhula
Cc: linux-kernel, dri-devel, linux-fbdev
In-Reply-To: <20251205-cgbc-backlight-v6-2-e4175b0bf406@novatron.fi>
On Fri, 05 Dec 2025 12:19:48 +0000, Petri Karhula wrote:
> The Board Controller has control for display backlight.
> Add backlight cell for the cgbc-backlight driver which
> adds support for backlight brightness control.
>
>
Applied, thanks!
[2/2] mfd: cgbc: Add support for backlight
commit: 7c5a0d97bb1bc1df127107bf46f6ae49d73094d4
--
Lee Jones [李琼斯]
^ permalink raw reply
* Re: (subset) [PATCH v3 0/7] Fix PMI8994 WLED ovp values and more
From: Lee Jones @ 2026-02-04 10:26 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Kiran Gunda,
Helge Deller, Luca Weiss, Konrad Dybcio, Eugene Lepshy,
Gianluca Boiano, Alejandro Tafalla,
Barnabás Czémán
Cc: dri-devel, linux-leds, devicetree, linux-kernel, Daniel Thompson,
linux-arm-msm, linux-fbdev, Konrad Dybcio, Krzysztof Kozlowski
In-Reply-To: <20260116-pmi8950-wled-v3-0-e6c93de84079@mainlining.org>
On Fri, 16 Jan 2026 08:07:32 +0100, Barnabás Czémán wrote:
> This patch series fixes supported ovp values related to pmi8994 wled
> and set same configuration for pmi8950 wled.
> It also corrects wled related properties in xiaomi-daisy, xiaomi-land and
> in xiaomi-vince.
>
>
Applied, thanks!
[1/7] dt-bindings: backlight: qcom-wled: Document ovp values for PMI8994
commit: 02031064bb8f387d81988a8abb211f1366d87582
[2/7] backlight: qcom-wled: Support ovp values for PMI8994
commit: f29f972a6e7e3f187ea4d89b98a76c1981ca4d53
[3/7] dt-bindings: backlight: qcom-wled: Document ovp values for PMI8950
commit: b2df6cf10d5242bfef2cc957d83738ccb560ed9f
[4/7] backlight: qcom-wled: Change PM8950 WLED configurations
commit: 83333aa97441ba7ce32b91e8a007c72d316a1c67
--
Lee Jones [李琼斯]
^ permalink raw reply
* [PATCH v2 4/4] staging: sm750fb: remove debug prints and convert logging in sm750_hw.c
From: Artem Lytkin @ 2026-02-04 10:15 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
In-Reply-To: <20260204101536.3311-1-iprintercanon@gmail.com>
Remove diagnostic pr_info prints that dump physical and virtual
memory addresses. Convert remaining pr_err calls to dev_err in
hw_sm750_map() where struct pci_dev *pdev is available.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750_hw.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index ce46f240c..420ebe057 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -34,8 +34,6 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
sm750_dev->vidreg_start = pci_resource_start(pdev, 1);
sm750_dev->vidreg_size = SZ_2M;
- pr_info("mmio phyAddr = %lx\n", sm750_dev->vidreg_start);
-
/*
* reserve the vidreg space of smi adaptor
* if you do this, you need to add release region code
@@ -44,7 +42,7 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
*/
ret = pci_request_region(pdev, 1, "sm750fb");
if (ret) {
- pr_err("Can not request PCI regions.\n");
+ dev_err(&pdev->dev, "Can not request PCI regions.\n");
goto exit;
}
@@ -52,12 +50,10 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
sm750_dev->pvReg =
ioremap(sm750_dev->vidreg_start, sm750_dev->vidreg_size);
if (!sm750_dev->pvReg) {
- pr_err("mmio failed\n");
+ dev_err(&pdev->dev, "mmio failed\n");
ret = -EFAULT;
goto exit;
}
- pr_info("mmio virtual addr = %p\n", sm750_dev->pvReg);
-
sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
@@ -72,19 +68,16 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
* @ddk750_get_vm_size function can be safe.
*/
sm750_dev->vidmem_size = ddk750_get_vm_size();
- pr_info("video memory phyAddr = %lx, size = %u bytes\n",
- sm750_dev->vidmem_start, sm750_dev->vidmem_size);
/* reserve the vidmem space of smi adaptor */
sm750_dev->pvMem =
ioremap_wc(sm750_dev->vidmem_start, sm750_dev->vidmem_size);
if (!sm750_dev->pvMem) {
iounmap(sm750_dev->pvReg);
- pr_err("Map video memory failed\n");
+ dev_err(&pdev->dev, "Map video memory failed\n");
ret = -EFAULT;
goto exit;
}
- pr_info("video memory vaddr = %p\n", sm750_dev->pvMem);
exit:
return ret;
}
@@ -163,11 +156,11 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
* The following register values for CH7301 are from
* Chrontel app note and our experiment.
*/
- pr_info("yes,CH7301 DVI chip found\n");
+ dev_info(&pdev->dev, "CH7301 DVI chip found\n");
sm750_sw_i2c_write_reg(0xec, 0x1d, 0x16);
sm750_sw_i2c_write_reg(0xec, 0x21, 0x9);
sm750_sw_i2c_write_reg(0xec, 0x49, 0xC0);
- pr_info("okay,CH7301 DVI chip setup done\n");
+ dev_info(&pdev->dev, "CH7301 DVI chip setup done\n");
}
}
--
2.43.0
^ permalink raw reply related
* [PATCH v2 3/4] staging: sm750fb: remove debug prints and convert logging in sm750.c
From: Artem Lytkin @ 2026-02-04 10:15 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
In-Reply-To: <20260204101536.3311-1-iprintercanon@gmail.com>
Remove debug prints disguised as pr_info that dump internal variable
values, pointer addresses, and structure contents. Convert remaining
meaningful pr_err and pr_warn calls to dev_err and dev_warn where
device context is available.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 85 ++++++++-------------------------
1 file changed, 20 insertions(+), 65 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 73d78f893..1feb97bee 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -375,7 +375,6 @@ static int lynxfb_ops_set_par(struct fb_info *info)
line_length = var->xres_virtual * var->bits_per_pixel / 8;
line_length = ALIGN(line_length, crtc->line_pad);
fix->line_length = line_length;
- pr_info("fix->line_length = %d\n", fix->line_length);
/*
* var->red,green,blue,transp are need to be set by driver
@@ -389,7 +388,8 @@ static int lynxfb_ops_set_par(struct fb_info *info)
var->accel_flags = 0;/*FB_ACCELF_TEXT;*/
if (ret) {
- pr_err("bpp %d not supported\n", var->bits_per_pixel);
+ dev_err(info->device, "bpp %d not supported\n",
+ var->bits_per_pixel);
return ret;
}
ret = hw_sm750_crtc_set_mode(crtc, var, fix);
@@ -485,15 +485,11 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
par = info->par;
crtc = &par->crtc;
- pr_debug("check var:%dx%d-%d\n",
- var->xres,
- var->yres,
- var->bits_per_pixel);
-
ret = lynxfb_set_color_offsets(info);
if (ret) {
- pr_err("bpp %d not supported\n", var->bits_per_pixel);
+ dev_err(info->device, "bpp %d not supported\n",
+ var->bits_per_pixel);
return ret;
}
@@ -508,7 +504,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
request = ALIGN(request, crtc->line_pad);
request = request * var->yres_virtual;
if (crtc->vidmem_size < request) {
- pr_err("not enough video memory for mode\n");
+ dev_err(info->device, "not enough video memory for mode\n");
return -ENOMEM;
}
@@ -533,7 +529,7 @@ static int lynxfb_ops_setcolreg(unsigned int regno,
ret = 0;
if (regno > 256) {
- pr_err("regno = %d\n", regno);
+ dev_err(info->device, "regno = %d\n", regno);
return -EINVAL;
}
@@ -580,7 +576,6 @@ static int lynxfb_ops_blank(int blank, struct fb_info *info)
struct lynxfb_par *par;
struct lynxfb_output *output;
- pr_debug("blank = %d.\n", blank);
par = info->par;
output = &par->output;
sm750_dev = par->dev;
@@ -625,7 +620,6 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->channel = sm750_primary;
crtc->o_screen = 0;
crtc->v_screen = sm750_dev->pvMem;
- pr_info("use simul primary mode\n");
break;
case sm750_simul_sec:
output->paths = sm750_pnc;
@@ -767,7 +761,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
crtc->cursor.mmio = sm750_dev->pvReg +
0x800f0 + (int)crtc->channel * 0x140;
- pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
crtc->cursor.max_h = 64;
crtc->cursor.max_w = 64;
crtc->cursor.size = crtc->cursor.max_h * crtc->cursor.max_w * 2 / 8;
@@ -802,46 +795,26 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
pdb[i], cdb[i], NULL, 8);
if (ret == 1) {
- pr_info("success! use specified mode:%s in %s\n",
- g_fbmode[index],
- mdb_desc[i]);
+ dev_info(info->device,
+ "use specified mode:%s in %s\n",
+ g_fbmode[index],
+ mdb_desc[i]);
break;
} else if (ret == 2) {
- pr_warn("use specified mode:%s in %s,with an ignored refresh rate\n",
- g_fbmode[index],
- mdb_desc[i]);
+ dev_warn(info->device,
+ "use specified mode:%s in %s, with an ignored refresh rate\n",
+ g_fbmode[index],
+ mdb_desc[i]);
break;
- } else if (ret == 3) {
- pr_warn("wanna use default mode\n");
- /*break;*/
- } else if (ret == 4) {
- pr_warn("fall back to any valid mode\n");
+ } else if (ret == 3 || ret == 4) {
+ continue;
} else {
- pr_warn("ret = %d,fb_find_mode failed,with %s\n",
- ret,
- mdb_desc[i]);
+ dev_warn(info->device,
+ "fb_find_mode failed with %s (ret=%d)\n",
+ mdb_desc[i], ret);
}
}
- /* some member of info->var had been set by fb_find_mode */
-
- pr_info("Member of info->var is :\n"
- "xres=%d\n"
- "yres=%d\n"
- "xres_virtual=%d\n"
- "yres_virtual=%d\n"
- "xoffset=%d\n"
- "yoffset=%d\n"
- "bits_per_pixel=%d\n"
- " ...\n",
- var->xres,
- var->yres,
- var->xres_virtual,
- var->yres_virtual,
- var->xoffset,
- var->yoffset,
- var->bits_per_pixel);
-
/* set par */
par->info = info;
@@ -851,7 +824,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
info->pseudo_palette = &par->pseudo_palette[0];
info->screen_base = crtc->v_screen;
- pr_debug("screen_base vaddr = %p\n", info->screen_base);
info->screen_size = line_length * var->yres_virtual;
/* set info->fix */
@@ -865,7 +837,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
strscpy(fix->id, fixId[index], sizeof(fix->id));
fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start;
- pr_info("fix->smem_start = %lx\n", fix->smem_start);
/*
* according to mmap experiment from user space application,
* fix->mmio_len should not larger than virtual size
@@ -874,13 +845,10 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
* data into the bound over virtual size
*/
fix->smem_len = crtc->vidmem_size;
- pr_info("fix->smem_len = %x\n", fix->smem_len);
info->screen_size = fix->smem_len;
fix->line_length = line_length;
fix->mmio_start = sm750_dev->vidreg_start;
- pr_info("fix->mmio_start = %lx\n", fix->mmio_start);
fix->mmio_len = sm750_dev->vidreg_size;
- pr_info("fix->mmio_len = %x\n", fix->mmio_len);
lynxfb_set_visual_mode(info);
@@ -889,22 +857,12 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
var->accel_flags = 0;
var->vmode = FB_VMODE_NONINTERLACED;
- pr_debug("#1 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
- info->cmap.start, info->cmap.len,
- info->cmap.red, info->cmap.green, info->cmap.blue,
- info->cmap.transp);
-
ret = fb_alloc_cmap(&info->cmap, 256, 0);
if (ret < 0) {
- pr_err("Could not allocate memory for cmap.\n");
+ dev_err(info->device, "Could not allocate memory for cmap.\n");
goto exit;
}
- pr_debug("#2 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n",
- info->cmap.start, info->cmap.len,
- info->cmap.red, info->cmap.green, info->cmap.blue,
- info->cmap.transp);
-
exit:
lynxfb_ops_check_var(var, info);
return ret;
@@ -934,9 +892,6 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
}
while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
- dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
- dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
-
if (!strcmp(opt, "swap")) {
swap = 1;
} else if (!strcmp(opt, "nocrt")) {
--
2.43.0
^ permalink raw reply related
* [PATCH v2 2/4] staging: sm750fb: use strcmp() for exact option matching
From: Artem Lytkin @ 2026-02-04 10:15 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Artem Lytkin
In-Reply-To: <20260204101536.3311-1-iprintercanon@gmail.com>
Replace strncmp(opt, "...", strlen("...")) with strcmp() in option
parsing functions. Options from strsep() are complete null-terminated
tokens, so prefix matching via strncmp() could cause false positives
for options like "noaccelXYZ" matching "noaccel".
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 0eacb522d..73d78f893 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -937,21 +937,21 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
- if (!strncmp(opt, "swap", strlen("swap"))) {
+ if (!strcmp(opt, "swap")) {
swap = 1;
- } else if (!strncmp(opt, "nocrt", strlen("nocrt"))) {
+ } else if (!strcmp(opt, "nocrt")) {
sm750_dev->nocrt = 1;
- } else if (!strncmp(opt, "36bit", strlen("36bit"))) {
+ } else if (!strcmp(opt, "36bit")) {
sm750_dev->pnltype = sm750_doubleTFT;
- } else if (!strncmp(opt, "18bit", strlen("18bit"))) {
+ } else if (!strcmp(opt, "18bit")) {
sm750_dev->pnltype = sm750_dualTFT;
- } else if (!strncmp(opt, "24bit", strlen("24bit"))) {
+ } else if (!strcmp(opt, "24bit")) {
sm750_dev->pnltype = sm750_24TFT;
- } else if (!strncmp(opt, "nohwc0", strlen("nohwc0"))) {
+ } else if (!strcmp(opt, "nohwc0")) {
g_hwcursor &= ~0x1;
- } else if (!strncmp(opt, "nohwc1", strlen("nohwc1"))) {
+ } else if (!strcmp(opt, "nohwc1")) {
g_hwcursor &= ~0x2;
- } else if (!strncmp(opt, "nohwc", strlen("nohwc"))) {
+ } else if (!strcmp(opt, "nohwc")) {
g_hwcursor = 0;
} else {
if (!g_fbmode[0]) {
@@ -1156,11 +1156,11 @@ static int __init lynxfb_setup(char *options)
*/
while ((opt = strsep(&options, ":")) != NULL) {
/* options that mean for any lynx chips are configured here */
- if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
+ if (!strcmp(opt, "noaccel")) {
g_noaccel = 1;
- } else if (!strncmp(opt, "nomtrr", strlen("nomtrr"))) {
+ } else if (!strcmp(opt, "nomtrr")) {
g_nomtrr = 1;
- } else if (!strncmp(opt, "dual", strlen("dual"))) {
+ } else if (!strcmp(opt, "dual")) {
g_dualview = 1;
} else {
size_t opt_len = strlen(opt);
--
2.43.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox