[bug report] bus: ti-sysc: Implement display subsystem reset quirk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Tony Lindgren,

The patch 7324a7a0d5e2: "bus: ti-sysc: Implement display subsystem
reset quirk" from Feb 24, 2020, leads to the following Smatch static
checker warning:

	drivers/bus/ti-sysc.c:1806 sysc_quirk_dispc()
	warn: masking a bool

drivers/bus/ti-sysc.c
    1756 static u32 sysc_quirk_dispc(struct sysc *ddata, int dispc_offset,
    1757                             bool disable)
    1758 {
    1759         bool lcd_en, digit_en, lcd2_en = false, lcd3_en = false;
    1760         const int lcd_en_mask = BIT(0), digit_en_mask = BIT(1);
    1761         int manager_count;
    1762         bool framedonetv_irq = true;
    1763         u32 val, irq_mask = 0;
    1764 
    1765         switch (sysc_soc->soc) {
    1766         case SOC_2420 ... SOC_3630:
    1767                 manager_count = 2;
    1768                 framedonetv_irq = false;
    1769                 break;
    1770         case SOC_4430 ... SOC_4470:
    1771                 manager_count = 3;
    1772                 break;
    1773         case SOC_5430:
    1774         case SOC_DRA7:
    1775                 manager_count = 4;
    1776                 break;
    1777         case SOC_AM4:
    1778                 manager_count = 1;
    1779                 framedonetv_irq = false;
    1780                 break;
    1781         case SOC_UNKNOWN:
    1782         default:
    1783                 return 0;
    1784         }
    1785 
    1786         /* Remap the whole module range to be able to reset dispc outputs */
    1787         devm_iounmap(ddata->dev, ddata->module_va);
    1788         ddata->module_va = devm_ioremap(ddata->dev,
    1789                                         ddata->module_pa,
    1790                                         ddata->module_size);
    1791         if (!ddata->module_va)
    1792                 return -EIO;
    1793 
    1794         /* DISP_CONTROL */
    1795         val = sysc_read(ddata, dispc_offset + 0x40);
    1796         lcd_en = val & lcd_en_mask;
    1797         digit_en = val & digit_en_mask;
    1798         if (lcd_en)
    1799                 irq_mask |= BIT(0);                        /* FRAMEDONE */
    1800         if (digit_en) {
    1801                 if (framedonetv_irq)
    1802                         irq_mask |= BIT(24);                /* FRAMEDONETV */
    1803                 else
    1804                         irq_mask |= BIT(2) | BIT(3);        /* EVSYNC bits */
    1805         }
--> 1806         if (disable & (lcd_en | digit_en))

digit_en is BIT(1) so this mask doesn't make sense.  Probably logical
&& and || were intended or && and |?

    1807                 sysc_write(ddata, dispc_offset + 0x40,
    1808                            val & ~(lcd_en_mask | digit_en_mask));
    1809 
    1810         if (manager_count <= 2)
    1811                 return irq_mask;
    1812 
    1813         /* DISPC_CONTROL2 */
    1814         val = sysc_read(ddata, dispc_offset + 0x238);
    1815         lcd2_en = val & lcd_en_mask;
    1816         if (lcd2_en)
    1817                 irq_mask |= BIT(22);                        /* FRAMEDONE2 */
    1818         if (disable && lcd2_en)
    1819                 sysc_write(ddata, dispc_offset + 0x238,
    1820                            val & ~lcd_en_mask);
    1821 
    1822         if (manager_count <= 3)
    1823                 return irq_mask;
    1824 
    1825         /* DISPC_CONTROL3 */
    1826         val = sysc_read(ddata, dispc_offset + 0x848);
    1827         lcd3_en = val & lcd_en_mask;
    1828         if (lcd3_en)
    1829                 irq_mask |= BIT(30);                        /* FRAMEDONE3 */
    1830         if (disable && lcd3_en)
    1831                 sysc_write(ddata, dispc_offset + 0x848,
    1832                            val & ~lcd_en_mask);
    1833 
    1834         return irq_mask;
    1835 }

regards,
dan carpenter



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux