tty: vt: remove checks for count in consw::con_clear() implementations
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Mon, 22 Jan 2024 11:03:36 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jan 2024 02:08:53 +0000 (18:08 -0800)
'count' in consw::con_clear() is guaranteed to be positive. csi_X() (the
only caller) takes the minimum of the vc parameter (which is at least 1)
and count of characters till the end of the line. The latter is computed
as a subtraction of vc->vc_cols (count) and vc->state.x (offset). So for
the worst case, full line, it is 1.

Therefore, there is no point in checking zero or negative values (width
is now unsigned anyway).

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-parisc@vger.kernel.org
Tested-by: Helge Deller <deller@gmx.de> # parisc STI console
Link: https://lore.kernel.org/r/20240122110401.7289-23-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/console/mdacon.c
drivers/video/console/sticon.c

index 1ddbb6cd5b0ca8ec59786e84ef773de12cc8317b..2ff2c9394d4092b462c8317ea9fd944bf0364882 100644 (file)
@@ -448,9 +448,6 @@ static void mdacon_clear(struct vc_data *c, unsigned int y, unsigned int x,
        u16 *dest = mda_addr(x, y);
        u16 eattr = mda_convert_attr(c->vc_video_erase_char);
 
-       if (width <= 0)
-               return;
-
        scr_memsetw(dest, eattr, width * 2);
 }
 
index d99c2a659bfd4b153ce069dfee3654916292c41a..b1d972d9a31c80ce0d879857da04a5868b222af7 100644 (file)
@@ -303,9 +303,6 @@ static void sticon_deinit(struct vc_data *c)
 static void sticon_clear(struct vc_data *conp, unsigned int sy, unsigned int sx,
                         unsigned int width)
 {
-    if (!width)
-       return;
-
     sti_clear(sticon_sti, sy, sx, 1, width,
              conp->vc_video_erase_char, font_data[conp->vc_num]);
 }